Can :GetNameFromuserId() be used on a player's ID without them being in the same session?

So I’m making an admin GUI for my game, and it requires converting a UserId to a Username. I noticed there was a Player:GetNameFromUserId() function, however I’m not sure how you’re supposed to use it to convert that when the player isn’t in your session (If possible).

What I want to achieve: Aforementioned.

There’s not an issue Here, just a question.

I’ve tried looking on other sources on this question but there doesn’t appear to be any solutions.

1 Like

Are you sure you can’t just use Player.Name?

yes, because it lets you adjust a players stored data, and if they aren’t in the game you cannot use Player.Name.

I found this, does this help any?

https://developer.roblox.com/en-us/api-reference/function/Players/GetNameFromUserIdAsync

I’ve already looked over this. I’m not 100% sure if its function is fitting to what I’m trying to do.

That function definitely does work. It’s not a function of Player, it’s a function of the Players service.

local Players = game:GetService("Players")
local Name = Players:GetNameFromUserIdAsync(UserId)
1 Like

Alright it appears this does indeed work. My inquiry was whether you could request names from userid’s without the user being in the same game since usually you would do:

game.Players["Name"].UserId

Thank you for clearing that up. Much Appreciated!