Data type
User
Represents a user's domain-scoped identity within a specific domain.
About User
The User data type represents a user's scoped identity within a specific domain, such as an experience or OAuth application. It encapsulates a domain user ID alongside the domain metadata that uniquely identifies that user within that domain.
Unlike a numeric user ID alone, a User value carries its domain
context, making it unambiguous across experiences and apps. It is the standard
identifier for referencing users in new experience code and is available from
Player.User.
Domain User IDs
User IDs on Roblox are domain-scoped: a single account has a unique domain user ID for each experience or app it interacts with. This ensures that user activity in one experience cannot be correlated with activity in another by a third party using the user ID alone.
A domain user ID is an integer that is unique within a given domain
(identified by DomainType and domain ID). Domain user IDs are
guaranteed not to collide with existing global user IDs.
Serialization
User supports round-trip string serialization via
ToString() and
fromString(). A User serialized with
ToString() and deserialized with fromString() produces an identical value.
The encoded string is stable, URL-safe, and compact. Use it when persisting or
transmitting user identity across systems.
Users vs. Players
A User represents persistent identity, not live server presence. It
can reference any account in the domain, whether or not that user is currently
connected. Use Player when you need the in-server instance.
Constructors 2
Properties 3
Id
: int64The domain user ID, unique within this domain.The domain user ID for this user within the associated domain. This is an integer that uniquely identifies the user within the specific domain type and domain ID combination.
DomainType
: DomainTypeThe type of domain that this domain user ID belongs to.The
DomainTypethat identifies the kind of domain this domain user ID belongs to. Currently supported values areDomainType.EXPERIENCEandDomainType.OAUTH.DomainId
: int64The identifier of the specific domain instance.The identifier of the specific domain instance that this user ID is scoped to. For
DomainType.EXPERIENCE, this is the universe ID. ForDomainType.OAUTH, this is the application ID.
Methods 1
ToString
() → stringSerializes thisUserinto a stable string representation.Serializes this
Userinto a string that encodes the domain type, domain ID, and domain user ID. The result is stable, URL-safe, and compact. Use this when storing or transmitting user identity.The string can be converted back to a
UserviafromString().
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.