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 get a player's ID?

Either from when they join with

game.Players.PlayerAdded:connect(function(player)

or from their user name,

game.Players.LocalPlayer.Name

how can I get their ID?

1 answer

✓ Accepted answer

The userId is a property that you can get from a player instance

game.Players.LocalPlayer.UserId

If you want to find the userId from a player which is not in the game, you might wanna use this function http://wiki.roblox.com/index.php?title=API:Class/Players/GetUserIdFromNameAsync

And of course, you can get a player's name from userId http://wiki.roblox.com/index.php?title=API:Class/Players/GetNameFromUserIdAsync

You should take a look at the Roblox API if you need specific functions, they might already exist.

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