How come I can't get the correct userid?

Im trying to make a level select system where the player can only access the next level if they have the correct badge.

However GetUserIdFromNameAsync doesnt seem to be working correctly. I dont know if i’m using it the wrong way but whenever I run the script it just prints out this…



Is there any reason that it might not be the full user ID?
This is what a snippet of the script looks like, it waits for the Proximity Prompt to be trigger, then it gets the player’s userID that triggered it, checks if that ID has the badge, and if they do the script should run.


1 Like

You’re passing the player object into the function instead of their name.

Easy fix:

local UserId = game:GetService("Players"):GetUserIdFromNameAsync(player.Name)

Give this a try and see if it works!


Ahhh! That seems like such a silly mistake, im still so new to scripting. Thank you, everything works now!!!


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.