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