PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

PlayerAdded

Fires whenever a Player is assigned to the Team. A player is considered assigned if their Player/Team property is equal to the Team and 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)

Parameters

Name Type Default Description

The Player that was added.


Code Samples


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.