Getting your local player in roblox studio

I would like to get my roblox player ID while in studio using the command line.

In team create, you can get your local player with

print(game.Players.LocalPlayer)

Then grab the UserID.

However, in games with team create disabled, it returns nil.
image

You can just use your player name or you can have the names and ids listed

for _, Player in ipairs(game.Players:GetPlayers()) do
    print(tostring(Player.UserId).." - "..Player.Name)
end

I’m in a local game (local save file of studio) so GetPlayers doesn’t return anything.

image
image

ohhh. You can’t do it in a local file through command bar. You can however use it in a script.

check out studio service, i think it has a way to get the local plr

im on mobile sorry

They’re right. You can use GetUserId

2 Likes

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