Getting a Username from UserId


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.

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 =

You forgot .Value I think.

script.Parent.Head.BillboardGui.Frame.TextLabel.Text =
1 Like

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.