Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way to automatically get someones roblox user id?

For example I'm making a starter menu and would like to have a page where it says "profile" and would like to automatically have your roblox USER ID shown and your "Account" age but I'm not totally sure how to do it.. like I've tried everything and nothing is working

3 answers

✓ Accepted answer

You can get a players properties(such as their account age and userid by doing something like this)

local plr = game.Players.LocalPlayer
local UserID = plr.UserId ------ Then you can change that to anything like AccountAge, MembershipType and Every property in player

1 comment

0

Do I put this in a text label?

The easiest way to do this is by using GetUserIdFromNameAsync

Here: https://developer.roblox.com/en-us/api-reference/function/Players/GetUserIdFromNameAsync

Example code:

game.Players.PlayerAdded:Connect(function(p) -- PlayerAdded event
local UserId = game.Players:GetUserIdFromNameAsync(p.Name) -- How to use it; must be a string and a valid username.
print(UserId) -- Prints their userid
end) -- Ends this event

2 comments

0

I'm so confused tbh I wish it was much simpler

0

It's actually really simple though. One line: "game.Players:GetUserIdFromNameAsync("Pupppy44")", and it returns 131470756, my userid.

This discussion is preserved as it was. New answers, comments, and votes are closed.