Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
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.
Code samples: View on Creator Hub (User-Overview).
Constructors
| Name | Type / Returns | Description |
|---|---|---|
| User.fromId | Creates a User from a domain user ID within the current experience. | |
| User.fromString | Creates a User from its serialized string form. |
User.fromId
Creates a new User from the given domain user ID, using the current experience as the domain. The ID must be a valid domain user ID (above the global user ID range).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| domainUserId | int64 | The domain-scoped user ID to construct the User from. Must be above the global user ID range. |
Code samples: View on Creator Hub (User-fromId).
User.fromString
Deserializes a User from a string previously produced by ToString().
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| userString | string | A string previously produced by ToString(). |
Code samples: View on Creator Hub (User-fromString).
Properties
| Name | Type / Returns | Description |
|---|---|---|
| User.Id | int64 | The domain user ID, unique within this domain. |
| User.DomainType | DomainType | The type of domain that this domain user ID belongs to. |
| User.DomainId | int64 | The identifier of the specific domain instance. |
User.Id
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.
| Field | Value |
|---|---|
| type | int64 |
User.DomainType
The DomainType that identifies the kind of domain this domain user ID belongs to. Currently supported values are DomainType.EXPERIENCE and DomainType.OAUTH.
| Field | Value |
|---|---|
| type | DomainType |
User.DomainId
The identifier of the specific domain instance that this user ID is scoped to. For DomainType.EXPERIENCE, this is the universe ID. For DomainType.OAUTH, this is the application ID.
| Field | Value |
|---|---|
| type | int64 |
Methods
| Name | Type / Returns | Description |
|---|---|---|
| User:ToString | string | Serializes this User into a stable string representation. |
User:ToString
Serializes this User into 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 User via fromString().
Returns
| Type | Description |
|---|---|
| string | A stable, URL-safe encoded string representing the domain type, domain ID, and domain user ID that can be deserialized back with fromString(). |
Code samples: View on Creator Hub (User-ToString).