How do I make a function that only works for one team?

How would I make a function that works for one team?
For example: onTouch a player can get through a door (that uses script.Parent.Transparency)

Check their team before executing the function body either with an if statement or a guard clause. For Touched events you’ll be looking to use GetPlayerFromCharacter on the part that touches the door, confirm that there’s a non-nil player and then check that player’s team.

Quite sure there are team-only doors you can reference in the toolbox.

1 Like