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

How would I get the username of someone via their id?

Asked by 5 years ago

Let's just say I have someone's UID (user id). How could I use that UID to get their username?

1 answer

Log in to vote
0
Answered by
Avigant 2374 Moderation Voter Community Moderator
5 years ago

Call game.Players:GetNameFromUserIdAsync() to do this. Remember, that since this is a remote call, it will yield and can error. This means that you need to wrap this invocation in a pcall() to ensure that it doesn't error, and never assume that it will be successful.

Ad

Answer this question