Fires whenever a
Player is assigned to the
Team. A player is considered assigned if their
Player/Team property is equal to the
Player/Neutral is false.
This event is team specific and will only fire when a
Player joints the specific
Team. Any function connected to this event will be passed the
Player object of the player who joined the team. For example:
Team.PlayerAdded:Connect(function(player) print(player.Name.." has joined the team") end)
Simple Team Rebalance
This code sample includes a simple example of how to re-balance teams. When Team.AutoAssignable is set to true players will be added to Teams in a balanced fashion. However as Players leave the game this can lead to unbalanced teams as players are not reallocated. This code keeps track of the number of players in each team and, when players leave will check to see if the teams need re-balancing.