Is the player.UserId property a int or string?

I just was wondering if the UserId property is a integer or string. Also, is it readonly? Thank you!

Hey, good question, UserId is a integer. The difference between integers and strings is that integers are numbers and strings is a piece of text.

Thanks thats all I really needed I thought roblox made it a string, also is it readonly?

It’s an integer as stated here UserId. It’s technically not read only but you aren’t able to set it in studio or with a script.

It isn’t really read only but you can’t change a user’s UserId

Note that the property’s documentation page displays its type (integer).

https://developer.roblox.com/en-us/api-reference/property/Player/UserId

You’ll get a stack error if you attempt to assign a player’s “UserId” property.

local players = game:GetService("Players")

game.Players.PlayerAdded:Connect(function(player)
	player.UserId = 1
end)

image