Collapse Sidebar




The Team property is a reference to a Team object within the Teams service. It determines the team the player is on; if the Player isn’t on a team or has an invalid Player/TeamColor, this property is nil. When this property is set, the player has joined the Team and the Team/PlayerAdded event fires on the associated team. Similarly, Team/PlayerRemoved fires when the property is unset from a certain Team.

Code Samples

Playing/Spectating Teams

This code sample, although lengthy, is quite simple: detect when a player chats /play, then put them on the “Playing” team. When they die, move them back to the “Spectating” team.

Join Team Command

This code sample allows any player to chat "/jointeam " where is the name of a team. It uses string manipulation using string.sub and string.lower to make the command case-insensitive and allow for partial matches. For example, “/jointeam red” will match the team “Red Robins”.