Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is game.Players.ChildAdded not working?

Asked by 7 years ago
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.

0
Is it in a ServerScript in ServerScriptService? KingLoneCat 2642 — 7y
0
You need to instead use PlayerAdded because ChildAdded does not work for the Players instance. XxJRushxX 22 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

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).

Ad

Answer this question