Getting UserId from username

Is there a possible way to obtain a UserId from Username? I’m currently creating a textbox which transfers their text from textbox with a username, but I have no idea on how to convert it with another script.

3 Likes

Alright, thank you. I’ll review on that.

I don’t think that link will work, as I’d like to convert a username from textbox into their UserId.

You can either use .UserId property of Player or GetUserIdFromNameAsync.

The GetUserIdFromNameAsync function has only one parameter, which is a String. (Player’s username) and it will return a int64 (Player’s UserId)

Example:

local Player = game.Players.JakyeRU
print(Player.UserId)
local Username = "JakyeRU"
local PlayerService = game:GetService("Players")

print(PlayerService:GetUserIdFromNameAsync(Username))
10 Likes

Ah, I understand now. Thank you for the time!

1 Like