PlayerAdded (Event)

From Legacy Roblox Wiki
Revision as of 08:29, 28 January 2012 by >JulienDethurens (STOP CAPITALIZING LINKS IN THE MIDDLE OF SENTENCES!)
Jump to navigationJump to search
PlayerAdded ( Player player )
Description Fired after a player enters the game.
Member of: Players


Example

This code will print A player has entered: , followed by the player's name, everytime a player enters: game.Players.PlayerAdded:connect(function(player) print("A player has entered: " .. player.Name) end)


Note: This method does not work as expected in solo mode, because the player is created before scripts that connect to PlayerAdded run. To fix this problem during solo add this to the end of a script:

for _, player in pairs(game.Players:GetChildren()) do PlayerAdded(player) end

See Also