Skip to content

User

Not yet Datatype

Represents a user's domain-scoped identity within a specific domain.

Not implemented in Nova

This datatype is not registered in Nova's Lua VM. Constructing or receiving it from an API call will not work.

Description

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

fromId Not yet Creates a User from a domain user ID within the current experience.
User.fromId(domainUserId: int64)

Creates a User from a domain user ID within the current experience.

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).

fromString Not yet Creates a User from its serialized string form.
User.fromString(userString: string)

Creates a User from its serialized string form.

Deserializes a User from a string previously produced by ToString().

Properties

Id Not yet The domain user ID, unique within this domain.
User.Id()

The 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 Not yet The type of domain that this domain user ID belongs to.
User.DomainType()

The type of domain that this domain user ID belongs to.

The DomainType that identifies the kind of domain this domain user ID belongs to. Currently supported values are DomainType.EXPERIENCE and DomainType.OAUTH.

DomainId Not yet The identifier of the specific domain instance.
User.DomainId()

The 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. For DomainType.OAUTH, this is the application ID.

Methods

ToString Not yet Serializes this User into a stable string representation.
User:ToString()

Serializes this User into a stable string representation.

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().

Roblox reference: User