The TeamColor property determines which team a Player is associated with according to that Team’s
Team/TeamColor. Changing this property will change
Player/Team according to whichever team has the same
DataType/BrickColor for their
Team/TeamColor. If no Team object has the associated TeamColor, the player will not be associated with a team.
It’s often a better idea to set
Player/Team to the respective
Team instead of using this property. Setting this property often leads to repetition of the same BrickColor value for a certain teams across many scripts; this is something you want to avoid when adhering to the don’t-repeat-yourself principle.
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.