Getting a Username from UserId

Hello!

So I am trying to get a Username from a UserId for a textlabel but when I use the GetUserIdFromNameAsync service, I just keep getting the error “Unable to cast Instance to int64” and it breaks the script.

I am wondering if anyone can help me.

Wait…
Can you show the code, it sounds like its getting an instance.
And it’s :GetNameFromUserIdAsync() (From the link), are you sure this is the correct function?

Yes, because you’re probably putting the player argument as Player instance instead of putting the UserId. Can you share the script?

Its for a statue that I have in game

script.Parent.Head.BillboardGui.Frame.TextLabel.Text =
Players:GetNameFromUserIdAsync(script.Parent.Configuration.userId)

You forgot .Value I think.

script.Parent.Head.BillboardGui.Frame.TextLabel.Text =
Players:GetNameFromUserIdAsync(script.Parent.Configuration.userId.Value)
1 Like
script.Parent.Configuration.userId.Value

Try this if the “userid” is a type of Value Instance

Yes, I did, thank you.

Well, today’s listen to is double-check your work.