this link to get name from a UserID
there's nothing about it. but im trying to get the name from a user id (without them being in game)
if there's something else. I couldnt find anything beside this.
this link to get name from a UserID
there's nothing about it. but im trying to get the name from a user id (without them being in game)
if there's something else. I couldnt find anything beside this.
It's not too hard to understand. This is a function of the players service, the wiki informs us, so all we do is use the function.
local Players = game.Players
local id = 100
local nameOfPlayerWithId = Players:GetNameFromUserIdAsync(id)
print(nameOfPlayerWithId) --// baltimoreclarke
See? Not too hard.
You should use pcall for this in case the ID you provide isn't valid.
local succeeded, nameOfPlayerWithId = pcall(function()
return Players:GetNameFromUserIdAsync(id)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
ahh okay. i was putting a "." instead of ":"
You could still reference the function by indexing it instead of calling it as a method: Players.GetNameFromUserIdAsync(Players,id)