How do you get the players display name in-game?

sorry for the late reply i went to bed
Capture
but when i print the userid it says nil lol? but when i just print the userid normally it says the id so im very confused i think

GetUserInfosByUserIdsAsync Only allows numbers so like 10302302
I dont think you can define a varaible for it and do
lcoal Userid = 12033023

because it might not be able to read it?

That could be the case. When you printed typeof(userId) what did it say?

It said Unable to cast to Array ?? im going crazy lol but im pretty sure
GetUserInfosByUserIdsAsync is unable to read the defined variable

I have a feeling the error is correct and the userid you are getting are invalid. When you tonumbered them, they returned nil so that might mean your userId variable contains something other than a number

Even though you printed the userid and it looked fine

When you printed the typeof(userId) it errored usbled to cast to array?

Capture

The rrror is implying that userId is not a number.

but it is a number though because if i just print the userid it prints it so really not sure what the issue is

Type string.len(userId) and check if there are extra spaces. Idk anymore. Can you show the code you used to save their data and how you created the key? I am running out of ideas

Gtg to school now so won’t respond for awhile. Other devs could give you a hand

1 Like

Instead of doing this

print(typeof(UserInfo[1].DisplayName))
print((UserInfo[1].DisplayName))

I just did this instead and it printed out the displayname
thanks for the help though and enjoy school buddy :+1: