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

Does the local player thingy works, or does it need to be changed?

I don't know if this works, but is this right when I want to use "player"?

local player = game.Players.LocalPlayers

or does something need to be changed?

3 answers

✓ Accepted answer

As long as it's a local script, yes. If you want to get the player from a regular script I would recommend putting it StarterGui and doing this:

local player = script.Parent.Parent -- Gets the parent of StarterGui, but when playing it would be the parent of PlayerGui so it would find the player.

If you're in a LocalScript, your code is perfectly fine. For Scripts, you need to use the game.Players.PlayerAdded event (assuming you want to do something when a player is added to the game); you can learn from Roblox's leaderboard script (in the Toolbox) that uses this event and more.

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