Is there a way to get a display name out of a username/userid yet?

I want to get a user’s DisplayName from a Username or UserId without the user having to go into the game. Is there a way to do this yet?

Code below, and yes, this is how its supposed to work until i get the display names working.

local player = game.Players:GetNameFromUserIdAsync(1829034891)
print(owner)
script.Parent.Text = player

This answers your question.

Get display name out of Username/UserId

Make sure there is nothing that solve your problem before posting, sometimes just a quick search is needed and you have your answer.

wait im confused,
how do I use this? its not working for me

1 Like

Typo in previous post *

Here this works :

local UserService = game:GetService("UserService")

local success, result = pcall(function()
	return UserService:GetUserInfosByUserIdsAsync({80000}) -- UserId in here
end)

if success then
	for _, userInfo in ipairs(result) do
		print(userInfo.DisplayName) -- User displayName
 	end
end

Yeah its pretty easy actually, its just

game:GetService("UserService"):GetUserInfosByUserIdsAsync({UserId})[1].DisplayName

I don’t know why every guide makes it so complicated

1 Like

Worth wrapping it in a pcall() as it’s a network call which can fail (leading to errors).

2 Likes