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

How can I find a player not using localplayer?

Read the title above

2 answers

✓ Accepted answer
game.Players:FindFirstChild("player")

1 comment

0

try this just substitue "player" with their name

There are several methods.

On a server script, I use the Players.PlayerAdded event to register the player when they join the game.

game:GetService("Players").PlayerAdded:Connect(function(addedPlayer)
	print(addedPlayer.Name.." has joined the game!")
end)

You can use Players:GetPlayerFromCharacter() as well, which gets the player from their character model in Workspace.


Door.Touched:Connect(function(bodyPart)
	local Character = bodyPart.Parent
	local Player = game:GetService("Players"):GetPlayerFromCharacter(Character)
end)

Hope this helps!

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