PlayerAdded (Event)

From Legacy Roblox Wiki
Revision as of 00:09, 1 December 2008 by >Buckethead101
Jump to navigationJump to search
PlayerAdded ( Instance Player )
Description Fired after a player enters the game.
Member of: [[RBX.lua.Players (Object)|Players]]

Example:

function onPlayerEntered(newPlayer)
wait(10)
newPlayer.Character.Torso.Transparency = 1
end

game.Players.ChildAdded:connect(onPlayerEntered)

Or, you can make something happen when someone leaves.

function onPlayerLeave(Player) 
local h = Instance.new("Hint")
h.Parent = game.Workspace
h.Text = "A player has left!"
wait(3)
h:remove()
game.Players.ChildRemoved:connect(onPlayerLeave)