It’s a little complicated what I’m trying to make so I will just skip over that but basically I’m just trying to figure out is there a way to determine if a text is a User Id or a User Name without adding a manual switch which tells the code whether It’s a User Id or a User Name (Which I can do if need be). I’m not asking for any pre-made code I just need some possible ideas from another set of minds as you guys might be able to think of something I can’t.
Yes, it’s possible to do this. You can use Players
methods GetUserIdFromNameAsync
and GetNameFromUserIdAsync
.
You might want to run both and see if either/both of them yield a value.
- If
GetUserIdFromNameAsync
yields a value, then that means you have the ID of a player. - If
GetNameFromUserIdAsync
yields a value, then that means you have the username of a player. - If both yield a value, that means the text is both a username and an ID. You should pick one to take precedence (probably the ID).
- If neither of them yield a value, the text is neither a username nor an ID.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.