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

How do I figure out someone's ID with a script?

I really don't know how to do this. All I know is that you gotta get the player... and that's it.

2 answers

✓ Accepted answer

There's actually a Property in the Player that you can use to get it. Just use a script to get the player, then use this line of code:

PlayerID=Player.userId

If you don't know how to get the player, it can be done easily from a LocalScript using LocalPlayer, like this:

Player=game.Players.LocalPlayer
PlayerID=Player.userId

Also, from a server script, you could use a PlayerAdded function like this:

game.Players.PlayerAdded:connect(function(Player)
	PlayerID=Player.userId
end

There you go. I believe that should sum it up for you. If you have any further problems/questions, please leave a comment below. Hope I helped :P

####-Dyler3

Hi. I'm on mobile if it's confusing.

game.Players.PlayerAdded:connect(function(player) --When a player joins they create this function called 'player'

      print("User ID: " ..player.userId) --We indicated the userId with '.userId' inside 'player'.

end)

Let me know if this helped:)

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