Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is game.Players.ChildAdded not working?

local plr = game.Players.LocalPlayer

game.Players.ChildAdded:connect(function()
	print "Player has joined!"
end)

The

game.Players.ChildAdded:connect(function()
end)

is the part that's not working.

2 comments

0

Is it in a ServerScript in ServerScriptService?

0

You need to instead use PlayerAdded because ChildAdded does not work for the Players instance.

1 answer

Line 1 suggests that this is a LocalScript. The problem with PlayerAdded/ChildAdded in LocalScripts is that the player is added to game.Players before that player's LocalScripts start running.

Just take out the PlayerAdded/ChildAdded code (that is, lines 3 and 5 in your sample script).

This discussion is preserved as it was. New answers, comments, and votes are closed.