I need to know how to get the UserId of a player just by knowing his name.
COMMUNITY QUESTION
Player help needed?
2 answers
This question is very simple, thus the answer is also very simple.
local player = game.Players:FindFirstChild(name) -- This will find the player based on the name, so make sure "name" is the name you have.
local userId = player.userId -- The id of a user!
Hope this helped :)
If you want to get a player's userId from their username, even when they're not in game, use:
local username = "Builderman" -- Username goes here.
local userid = game.Players:GetUserIdFromNameAsync(username)
print(userid)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Do FindFirstChild with an uppercase F instead of lowercase, because findFirstChild is deprecated.
@LordDragonZord it still works but FindFirstChild instead of findFirstChild is just more efficient it won't effect the script