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

How to make a script that accesses a player in the player folder?

PLEASE help me make a script that can access a player in the player folder... I need it to access a player with any name. (The game can only have one player in it) I NEED HELP!!!

1 answer

✓ Accepted answer

If the game only has one Player in it (i.e. a maximum server size of 1) then:

From a LocalScript you can just use

player = game.Players.LocalPlayer

From a global (normal) script you can use:

player = game.Players:GetChildren()[1]

In both cases it'd be best to wait for the player to exist before attempting to access it:

For the LocalScript version use:

while not game.Players.LocalPlayer do wait() end

For the global script version use:

while not #game.Players:GetChildren() > 0 do wait() end

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