Team Filter (Basic Mode)

PACKAGE: Team Filter

Search for and install Team Filter from the Community tab.

DESCRIPTION

Enables verifying a player is on a team that is the allowed list of teams or not. If they are, a pass-event will be fired, and if they are not, a fail-event will be fired.

Note: This package can be used in basic mode.

USAGE

Use of this script requires that you already have a script that can perform an action on. Below follows an example for how to do this, but you can use the script for many other things, such as only opening a chest if the user is on the correct team.

  1. Install the Team Filter package.
  2. Install the official Crayta package Door.
  3. Drag a door Mesh into your environment.
  4. Edit the door Mesh, and add the doorScript to your door entity.doorscript-simple
  5. Add the teamFilterScript to your door entity.
  6. In the teamFilterScript, click + and set allowedTeams to a list of team IDs that should be allowed.
  7. In the teamFilterScript, set onFilteredUserPass to invoke the doorScript of your door entity, and select doorScript in the Script field. And lastly, select SetOpening in the Event field.
  8. Edit the onInteract field of the door entity itself and set Entity equal to your door, Script equal to the teamFilterScript, and Event to FilterPlayer.

This will enable your players to interact with your door. If they are on a team on the allowed list of teams, the door will open, and if not, nothing will happen.

SETTINGS

  • allowedTeams: A list of team IDs that will ensure the pass event is fired.

METHODS

  • FilterPlayer(player): Checks whether the given player is on a team on the allowed list of teams or not. Fires onFilteredUserPass if they are, and onFilteredUserFail if they are not.

EVENTS

  • onFilteredUserPass: Fired after invoking FilterPlayer(player), and the player’s team was on the allowed list. Passes player as the only argument.
  • onFilteredUserFail: Fired after invoking FilterPlayer(player), and the player’s team was NOT on the allowed list. Passes player as the only argument.