PlayerAdded (Event): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Buckethead101
No edit summary
>Anaminus
fixed wrong example
Line 12: Line 12:
end
end


game.Players.ChildAdded:connect(onPlayerEntered)</pre>
game.Players.PlayerAdded:connect(onPlayerEntered)</pre>
 
Or, you can make something happen when someone leaves.
 
<pre>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)</pre>

Revision as of 03:38, 1 December 2008

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.PlayerAdded:connect(onPlayerEntered)