Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I find UserId from LocalPlayer [SOLVED]?

Asked by
Moxeh 84
10 years ago

I am working on a project and it all depends on me being able to allocate the UserId of the player and check to see if it matches the allowed one. How would I find the UserId from my LocalPlayer? Would it be through game.Players.LocalPlayer.Character? What is the best method for this? Thanks so much!

2 answers

Log in to vote
2
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

Just use the userId property, i.e.

print(game.Players.Player.userId)

If your only purpose is to allow only certain people to join the game, however, why would you not simply use their name?

0
IDs are better, because the player can just get a name change to bypass the filter (Spend 1,000 R$). Discern 1007 — 10y
0
Not if the name is already taken, so if you wanted specific people to be able to enter no one could take their name. For example, there is absolutely no one else in Roblox named Perci1, nor will there ever be. Perci1 4988 — 10y
0
@Perci1 he means the player itself changes it, for example, if your doing a currency system, and you use usernames. You don't like your username, change it, but then your currency goes to 0. Rawblocky 217 — 7y
0
dude i know, it's been two years lol Perci1 4988 — 7y
Ad
Log in to vote
1
Answered by
Maliux 0
10 years ago

In every player there are many options to choose from. For this occasion scroll down to userId

--Example-- (IN LOCAL SCRIPT)

print(game.Players.LocalPlayer.userId)
0
I figured it out and never saw this so I unfortunately have to say that Percil gave me the answer I needed. I knew about changing it to LocalPlayer and using a LocalScript. Thanks though. Moxeh 84 — 10y

Answer this question