I am trying to make it so I can get the player’s displayname from their UserId. I have found out that I can use Players:getUserInfosFromUserIdsAsync() to get the DisplayName but when I try to do that it comes up with an error from the pcall.
GetUserInfosByUserIdsAsync is not a valid member of Players "Players" - Client
I can’t figure out how I am suppose to do this. Can’t you use this function anymore?
Here is my code:
local userInfo
local success, errormessage = pcall(function()
userInfo = game.Players:GetUserInfosByUserIdsAsync({userID})
end
if success then
print(userInfo.Username)
print(userInfo.DisplayName)
playerInfoFrame:WaitForChild("DisplayName").Text = userInfo.DisplayName
playerInfoFrame:WaitForChild("Username").Text = userInfo.Username
else
warn(errormessage)
end
If you can’t use GetUserInfosByUserIdsAsync() anymore, is there an alternative?
Any help is appreciated.