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

How do you detect if a new player joins a game?

Asked by 9 years ago

I think the method is NewPlayer, don't know if that is even a method. I tried almost every method but failed for my script. Can someone help.

0
New player as in new to the game or new to the server? raspyjessie 117 — 9y
0
New to the server, like they just joined. Roboy5857 20 — 9y
0
Perci1's answer should do then raspyjessie 117 — 9y

1 answer

Log in to vote
2
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

There's a PlayerAdded event of Players that does exactly what you're looking for. When a player joins the game, this event will fire.

With an anonymous function

game.Players.PlayerAdded:connect(function(plr)
    print(plr.Name)
end)

With a normal function

function newPlayer(plr)
    print(plr.Name)
end
game.Players.PlayerAdded:connect(newPlayer)
Ad

Answer this question