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

How to detect players?

How would I go about detecting players when they are in the game or join a game.

1 comment

0

Next time you ask a question like this, tell us what you have tried already and what doesn't work. If you'd looked at the Players API on the Wiki then you wouldn't need to ask this question.

1 answer

To check if they are in the game:

if game.Players:FindFirstChild("Altlightpower26") then
	print("Altlightpower26 is in the game")
else
	print("Altlightpower26 is not in the game")
end

When a player joins and leaves

--Joins
game.Players.PlayerAdded:connect(function(Player)
	print(Player.Name.." has entered")
end)

--Leaves
game.Players.PlayerRemoving:connect(function(Player)
	print(Player.Name.." is leaving the game")
end)

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