Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
DataModel
Inherits from: ServiceProvider → Instance → Object
The Data Model (commonly known as game after the global variable used to access it) is the root of Roblox's parent-child hierarchy. Its direct children are services, such as Workspace and Lighting, that act as the fundamental components of a Roblox game.
Inherits from: ServiceProvider
Memory category: Instances
Tags: NotCreatable
Code samples: View on Creator Hub (DataModel1).
Properties
| Name | Type / Returns | Description |
|---|---|---|
| DataModel.CreatorId | int64 | Describes the ID of the user or group that owns the place. |
| DataModel.CreatorType | CreatorType | Describes the CreatorType of the place, whether the place is owned by a user or a group. |
| DataModel.GameId | int64 | Describes the ID of the experience that the place running on the server belongs to. |
| DataModel.GearGenreSetting | GearGenreSetting | Not functional. Historically described the gear permissions of the place as set on the Roblox website. |
| DataModel.Genre | Genre | Not functional. Historically described the Genre of the place as set on the Roblox website. |
| DataModel.JobId | string | A unique identifier for the running game server instance. |
| DataModel.lighting | Instance | Refers to the game's Lighting service. |
| DataModel.MatchmakingType | MatchmakingType | Represents how players in the server are handled by matchmaking. |
| DataModel.PlaceId | int64 | Describes the ID of the place running on the server. |
| DataModel.PlaceVersion | int | Describes the version of the place the server is running on. |
| DataModel.PrivateServerId | string | Describes the private server ID of the server, if the server is a private server or a reserved server. |
| DataModel.PrivateServerOwnerId | int64 | Describes the UserId of the Player that owns the private server if the server is private. |
| DataModel.RunService | RunService | A reference to the RunService service. |
| DataModel.VIPServerId | string | A string that could identify the current server as a private server. |
| DataModel.VIPServerOwnerId | int64 | The UserId of the account who owns the private server. |
| DataModel.Workspace | Workspace | A reference to the Workspace service. |
| DataModel.workspace | Workspace |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.Archivable | boolean | Determines if an Instance and its descendants can be cloned using Instance:Clone(), and can be saved/published. |
| Instance.archivable | boolean | |
| Instance.Capabilities | SecurityCapabilities | The set of capabilities allowed to be used for scripts inside this container. |
| Instance.IsInSandbox | boolean | Indicates whether the instance is inside a sandboxed container. |
| Instance.Name | string | A non-unique identifier of the Instance. |
| Instance.Parent | Instance | Determines the hierarchical parent of the Instance. |
| Instance.PredictionMode | PredictionMode | Reflects the client-side prediction mode applied to the instance under server-authoritative physics. |
| Instance.RobloxLocked | boolean | A deprecated property that used to protect CoreGui objects. |
| Instance.Sandboxed | boolean | When enabled, the instance can only access abilities in its Capabilities list. |
| Instance.UniqueId | UniqueId | A unique identifier for the instance. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.ClassName | string | A read-only string representing the class this Object belongs to. |
| Object.className | string |
DataModel.CreatorId
This property describes the ID of the user or group that owns the place. If the DataModel.CreatorType property is User then CreatorId will be the Player.UserId of the place's owner. If the DataModel.CreatorType is Group then CreatorId will be the ID of the group that owns the place.
| Field | Value |
|---|---|
| type | int64 |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | State |
| serialization | {"can_load":false,"can_save":false} |
Code samples: View on Creator Hub (detect-when-the-place-owner-joins-the-game).
DataModel.CreatorType
This property describes the CreatorType of the place, whether the place is owned by a user or a group. If User, then the DataModel.CreatorId property will describe the UserId of the account that owns the game. If Group, then it will describe the group ID.
| Field | Value |
|---|---|
| type | CreatorType |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | State |
| serialization | {"can_load":false,"can_save":false} |
Code samples: View on Creator Hub (detect-when-the-place-owner-joins-the-game).
DataModel.GameId
This property describes the ID of the experience that the place running on the server belongs to.
See Also
DataModel.PlaceId, which describes the ID of the place running on the serverDataModel.JobId, which is a unique identifier for the server game instance runningTeleportService, which is a service that can be used to transportPlayersbetween games
| Field | Value |
|---|---|
| type | int64 |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | State |
| serialization | {"can_load":false,"can_save":false} |
DataModel.GearGenreSetting
Deprecated. This property is deprecated and is no longer functional. It should not be used.
This property, along with DataModel.Genre, no longer functions correctly and attempting to read it may throw an error.
| Field | Value |
|---|---|
| type | GearGenreSetting |
| tags | ["ReadOnly","NotReplicated","Deprecated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | State |
| serialization | {"can_load":false,"can_save":false} |
DataModel.Genre
Deprecated. This property is deprecated and is no longer functional. It should not be used.
This property is broken and should not be used.
This property historically described the Genre of the place as set on the Roblox website.
This property, along with DataModel.GearGenreSetting, no longer functions correctly due to genres existing on the Roblox website that are not reflected in the Genre enum. As a result, attempting to read this property may throw an error.
| Field | Value |
|---|---|
| type | Genre |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | State |
| serialization | {"can_load":false,"can_save":false} |
DataModel.JobId
This property is a unique identifier for the running game server instance. It is a universally unique identifier (UUID), meaning that no two servers, past or present, will ever have the same ID.
Defaults to an empty string in Studio.
See Also
TeleportService:GetPlayerPlaceInstanceAsync()which can be used to retrieve theDataModel.JobIdof a user's current server.TeleportService:TeleportToPlaceInstance()which can be used to teleport aPlayerto a specific server.DataModel.PrivateServerIddescribes the ID of the private server the game server instance belongs to.HttpService:GenerateGUID(), a function that can be used to generate your own UUIDs.
| Field | Value |
|---|---|
| type | string |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | JobInfo |
| serialization | {"can_load":false,"can_save":false} |
DataModel.lighting
Deprecated. This item has been superseded by game:GetService("Lighting"), which should be used instead.
This property was once used to get the game's Lighting service.
| Field | Value |
|---|---|
| type | Instance |
| tags | ["ReadOnly","NotReplicated","Deprecated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":false} |
DataModel.MatchmakingType
This property represents how players in the server are handled by matchmaking. Players with different MatchmakingTypes cannot be in or teleport to the same server.
Note that this property is only valid on the server DataModel and it will be the MatchmakingType.Default value for all clients, so only reference this property inside of a server‑side Script.
| Field | Value |
|---|---|
| type | MatchmakingType |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":true} |
DataModel.PlaceId
This property describes the ID of the place running on the server.
If the place has not been published to Roblox, this ID will correspond with the template being used.
See Also
DataModel.GameId, which describes the ID of the experience that the current place belongs toDataModel.JobId, which is a unique identifier for the server game instance runningTeleportService, which is a service that can be used to transportPlayersbetween places
| Field | Value |
|---|---|
| type | int64 |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | State |
| serialization | {"can_load":false,"can_save":false} |
DataModel.PlaceVersion
This property describes the version of the place the server is running on.
This version number corresponds with the version number shown under the Version History section of the place's settings. It is not the current version of the Roblox client. This property is 0 for all unpublished experiences.
When a server instance is created for a place, it uses the place's current version. If the place is later updated while this server is running, the server will remain at its current version.
This property can be used to display a ScreenGui showing the current version of the game to Players to assist with debugging.
| Field | Value |
|---|---|
| type | int |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | State |
| serialization | {"can_load":false,"can_save":false} |
Code samples: View on Creator Hub (server-version-number-gui).
DataModel.PrivateServerId
This property describes the private server ID of the server, if the server is a private server.
If the server is not a private server, then this property will be an empty string.
Private servers
Private servers refer to the following:
- Private servers that users can purchase from the games page
- Reserved servers, private servers created by the developer using
TeleportService:ReserveServerAsync()
PrivateServerId vs JobId
The PrivateServerId of a server is different from the DataModel.JobId. The JobId is the unique identifier of the current server instance.
Private servers (private or reserved servers) can have multiple server instances associated with them over time. This is because, although only one server instance can be running at once for a private server, new server instances can open and close as players join and leave the game. For example, no server instance is running when nobody is playing in the server. The PrivateServerId will be consistent across all of these server instances, and the DataModel.JobId will be unique for each one.
See also:
DataModel.PrivateServerOwnerId, a property describing the owner of a private serverTeleportService:ReserveServerAsync(), a function which creates a reserved server
| Field | Value |
|---|---|
| type | string |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":true} |
Code samples: View on Creator Hub (detecting-private-servers).
DataModel.PrivateServerOwnerId
This property describes the UserId of the Player that owns the private server if the server is private.
If the server is a standard or reserved server then this property will be set to 0.
This property could be used to identify if a Player is the owner of the private server, for example:
local Players = game:GetService("Players")
-- is this a private server?
if game.PrivateServerId ~= "" and game.PrivateServerOwnerId ~= 0 then
-- listen for new players being added
Players.PlayerAdded:Connect(function(player)
-- check if the player is the server owner
if player.UserId == game.PrivateServerOwnerId then
print("The private server owner has joined the game")
end
end)
end See also:
DataModel.PrivateServerId, a property describing the unique ID of private andreserved servers
| Field | Value |
|---|---|
| type | int64 |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":true} |
Code samples: View on Creator Hub (detecting-private-servers).
DataModel.RunService
A reference to the RunService service. Always points to RunService and is never nil. You can also retrieve it with GetService(), for example game:GetService("RunService").
| Field | Value |
|---|---|
| type | RunService |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":false} |
DataModel.VIPServerId
Deprecated. This property has been deprecated. Use DataModel.PrivateServerId instead.
This property was string that could identify the current server as a private server.
| Field | Value |
|---|---|
| type | string |
| tags | ["Hidden","ReadOnly","NotReplicated","Deprecated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":true} |
DataModel.VIPServerOwnerId
Deprecated. This property has been deprecated. Use DataModel.PrivateServerOwnerId instead.
This property indicates the UserId of the account who owns the private server.
| Field | Value |
|---|---|
| type | int64 |
| tags | ["Hidden","ReadOnly","NotReplicated","Deprecated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":true} |
DataModel.Workspace
This property is a reference to the Workspace service. It always points to Workspace and will never be nil.
| Field | Value |
|---|---|
| type | Workspace |
| tags | ["ReadOnly","NotReplicated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":false} |
DataModel.workspace
Deprecated. This deprecated property is a variant of DataModel.Workspace which should be used instead.
| Field | Value |
|---|---|
| type | Workspace |
| tags | ["ReadOnly","NotReplicated","Deprecated"] |
| security | {"read":"None","write":"None"} |
| thread safety | ReadSafe |
| category | Data |
| serialization | {"can_load":false,"can_save":false} |
Methods
| Name | Type / Returns | Description |
|---|---|---|
| DataModel:BindToClose | () | Binds a function to be called before the server shuts down. |
| DataModel:GetJobsInfo | Array | Returns a table containing basic information about the jobs performed by the task scheduler. |
| DataModel:GetMessage | string | [OBSOLETE]: This function will always return a blank string. |
| DataModel:GetObjects | Instances | Returns an array of Instances associated with the given content URL. |
| DataModel:GetRemoteBuildMode | boolean | This method is no longer useful and will always return false. |
| DataModel:IsGearTypeAllowed | boolean | Returns whether gear of the given GearType is permitted to be added to Players' StarterGears. |
| DataModel:IsLoaded | boolean | Returns true if the client has finished loading the game for the first time. |
| DataModel:SavePlace | boolean | Saves the current place. |
| DataModel:SetPlaceId | () | Sets the DataModel.PlaceId of the current game instance. |
| DataModel:SetUniverseId | () | Sets the DataModel.GameId of the current game instance to the given universeId. |
Inherited from ServiceProvider
| Name | Type / Returns | Description |
|---|---|---|
| ServiceProvider:FindService | Instance | Returns the service specified by the given className if it's already created, errors for an invalid name. |
| ServiceProvider:GetService | Instance | Returns the service with the requested class name, creating it if it does not exist. |
| ServiceProvider:getService | Instance | |
| ServiceProvider:service | Instance |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance:AddTag | () | Applies a tag to the instance. |
| Instance:children | Instances | Returns an array of the object's children. |
| Instance:ClearAllChildren | () | This method destroys all of an instance's children. |
| Instance:Clone | Instance | Create a copy of an instance and all its descendants, ignoring instances that are not Archivable. |
| Instance:clone | Instance | |
| Instance:Destroy | () | Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy() on all children. |
| Instance:destroy | () | |
| Instance:FindFirstAncestor | Instance? | Returns the first ancestor of the Instance whose Instance.Name is equal to the given name. |
| Instance:FindFirstAncestorOfClass | Instance? | Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className. |
| Instance:FindFirstAncestorWhichIsA | Instance? | Returns the first ancestor of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstChild | Instance? | Returns the first child of the Instance found with the given name. |
| Instance:findFirstChild | Instance | |
| Instance:FindFirstChildOfClass | Instance? | Returns the first child of the Instance whose ClassName is equal to the given class name. |
| Instance:FindFirstChildWhichIsA | Instance? | Returns the first child of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstDescendant | Instance? | Returns the first descendant found with the given Instance.Name. |
| Instance:GetActor | Actor? | Returns the Actor associated with the Instance, if any. |
| Instance:GetAttribute | Variant | Returns the value which has been assigned to the given attribute name. |
| Instance:GetAttributeChangedSignal | RBXScriptSignal | Returns an event that fires when the given attribute changes. |
| Instance:GetAttributes | Dictionary | Returns a dictionary of the instance's attributes. |
| Instance:GetChildren | Instances | Returns an array containing all of the instance's children. |
| Instance:getChildren | Instances | |
| Instance:GetDebugId | string | Returns a coded string of the debug ID used internally by Roblox. |
| Instance:GetDescendants | Instances | Returns an array containing all of the descendants of the instance. |
| Instance:GetFullName | string | Returns a string describing the instance's ancestry. |
| Instance:GetStyled | Variant | Returns the styled or explicitly modified value of the specified property, or else the default property value if it hasn't been styled/modified. |
| Instance:GetStyledPropertyChangedSignal | RBXScriptSignal | Returns an event that fires when the given style property changes on the instance. |
| Instance:GetTags | Array | Gets an array of all tags applied to the instance. |
| Instance:HasTag | boolean | Check whether the instance has a given tag. |
| Instance:IsAncestorOf | boolean | Returns true if an Instance is an ancestor of the given descendant. |
| Instance:IsDescendantOf | boolean | Returns true if an Instance is a descendant of the given ancestor. |
| Instance:isDescendantOf | boolean | |
| Instance:IsPropertyModified | boolean | Returns true if the value stored in the specified property is not equal to the code-instantiated default. |
| Instance:QueryDescendants | Instances | Returns an array containing all descendants of the instance that match the selector string. |
| Instance:Remove | () | Sets the object's Parent to nil, and does the same for all its descendants. |
| Instance:remove | () | |
| Instance:RemoveTag | () | Removes a tag from the instance. |
| Instance:ResetPropertyToDefault | () | Resets a property to its default value. |
| Instance:SetAttribute | () | Sets the attribute with the given name to the given value. |
| Instance:WaitForChild | Instance | Returns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object:GetPropertyChangedSignal | RBXScriptSignal | Get an event that fires when a given property of the object changes. |
| Object:IsA | boolean | Returns true if an object's class matches or inherits from a given class. |
| Object:isA | boolean |
DataModel:BindToClose
Binds a function to be called before the server shuts down. If the bound function accepts a parameter, it passes CloseReason specifying the reason for the server shutdown.
You can bind multiple functions by calling BindToClose() repeatedly. Bound functions are called in parallel and run at the same time.
The experience server waits 30 seconds for all bound functions to stop running before it shuts down. After 30 seconds, the server shuts down even if functions are still running. Teleports are disabled during moderation shutdowns.
To verify that the current session is not in Roblox Studio, use RunService:IsStudio(). This prevents bound functions from completing their run in offline testing sessions.
When you use DataStoreService, you should also use BindToClose to bind a function saving all unsaved data to DataStores. This prevents data loss if the server shuts down unexpectedly.
See also:
CloseReasonfor reasons for the experience server shutdown.PluginGui:BindToClose(), which binds a function to aPluginGuiclose button.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| function | Function | A function called before the experience server shuts down. If the bound function accepts a parameter, it passes CloseReason specifying the reason for the server shutdown. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
Code samples: View on Creator Hub (saving-player-data-before-shutting-down, DataModel-BindToClose1).
DataModel:GetJobsInfo
Returns a table containing basic information about the jobs performed by the task scheduler.
In computing, a task scheduler is a system responsible for executing key tasks at the appropriate intervals.
You can also find live task scheduler statistics in the Task Scheduler window in Roblox Studio.
The first entry in the table returned is a reference dictionary containing the statistics (or headings) available. It is in the following format:
{
["name"] = "name",
["averageDutyCycle"] = "averageDutyCycle",
["averageStepsPerSecond"] = "averageStepsPerSecond",
["averageStepTime"] = "averageStepTime",
["averageError"] = "averageError",
["isRunning"] = "isRunning",
} The subsequent entries in the table returned are dictionaries containing the above statistics for jobs performed by the task scheduler. For example:
{
["name"] = "Heartbeat",
["averageDutyCycle"] = 0,
["averageStepsPerSecond"] = 0,
["averageStepTime"] = 0,
["averageError"] = 0,
["isRunning"] = false,
} See also:
Returns
| Type | Description |
|---|---|
| Array | A table containing information about the jobs performed by the task scheduler, see above for the format. |
| Field | Value |
|---|---|
| security | PluginSecurity |
| thread safety | Unsafe |
Code samples: View on Creator Hub (DataModel-GetJobsInfo1).
DataModel:GetMessage
Deprecated. This item is deprecated since the system was phased out a very long time ago, and recently the APIs for setting this message were removed.
This function will always return a blank string. It was originally used to set the message displayed on screen while the game was loading.
This system was phased out a very long time ago, and recently the APIs for setting this message were removed.
Returns
| Type | Description |
|---|---|
| string |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
DataModel:GetObjects
Deprecated. This item is deprecated. Do not use it for new work.
This method returns an array of Instances associated with the given content URL. It can be used to insert content from the Roblox library. It's not possible to insert Sounds using this method as they do not have an Instance associated with them and have only a content URL.
Unlike InsertService:LoadAsset(), DataModel:GetObjects() does not require an asset to be "trusted," meaning that an asset doesn't need to be owned by the logged in user, or created by Roblox, to be inserted. However, if the asset is not owned by the logged in user it must be freely available.
Due to this function's security context it can only be used by plugins or the command bar. For an alternative that can be used in Scripts and LocalScripts, see InsertService:LoadAsset().
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| url | ContentId | The given content URL. |
Returns
| Type | Description |
|---|---|
| Instances | An array of Instances associated with the content URL. |
| Field | Value |
|---|---|
| security | PluginSecurity |
| thread safety | Unsafe |
Code samples: View on Creator Hub (view-a-plugin-s-source-code, batch-convert-decal-web-urls-to-image-content-ids).
DataModel:GetRemoteBuildMode
Deprecated. This item is deprecated. Use RunService:IsServer() to see if your code is running on the server.
This method is no longer useful and will always return false. Use RunService:IsServer() to see if your code is running on the server.
Returns
| Type | Description |
|---|---|
| boolean |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
DataModel:IsGearTypeAllowed
Deprecated. This property is deprecated and is no longer functional. It should not be used.
Currently this function only returns the correct value on the client
This function returns whether gear of the given GearType is permitted to be added to Players' StarterGears. For example:
local meleeWeaponsAllowed = game:IsGearTypeAllowed(Enum.GearType.MeleeWeapons) Whether gear of a specific GearType is permitted in the game is determined in a place's settings page under 'Permissions'. Note, all of a gear's associated GearTypes must be enabled for it to be permitted in a place.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| gearType | GearType | The given GearType. |
Returns
| Type | Description |
|---|---|
| boolean | Whether gear of the given GearType is permitted in the game. |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
DataModel:IsLoaded
When all initial Instances in the game have finished replicating to the client, this function returns true.
Unless they are parented to ReplicatedFirst, LocalScripts do not run until the game has loaded. The following snippet, run from a LocalScript in ReplicatedFirst yields until the game has loaded:
if not game:IsLoaded() then
game.Loaded:Wait()
end See also:
- Replication order for a more detailed summary of the loading process.
DataModel.Loaded, an event that fires when the game has loadedInstance:WaitForChild(), a function which can be used to wait for an individualInstanceto replicate without having to wait for the whole game to finish loading.
Returns
| Type | Description |
|---|---|
| boolean | Whether the client has finished loading the game for the first time. |
| Field | Value |
|---|---|
| security | None |
| thread safety | Unsafe |
Code samples: View on Creator Hub (Custom-Loading-Screen).
DataModel:SavePlace
Deprecated. This item is deprecated. Do not use it for new work.
This function was used by an ancient data persistence method to save the current place.
Note:
- In order for this method to work the save place API has to be enabled for the current place.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| saveFilter | SaveFilter | SaveAll |
Returns
| Type | Description |
|---|---|
| boolean |
| Field | Value |
|---|---|
| tags | ["Yields","Deprecated"] |
| security | None |
| thread safety | Unsafe |
DataModel:SetPlaceId
This function sets the DataModel.PlaceId of the game instance to the given placeId.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| placeId | int64 | The ID to set the DataModel.PlaceId to. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | PluginSecurity |
| thread safety | Unsafe |
DataModel:SetUniverseId
This function sets the DataModel.GameId of the current game instance to the given universeId. This is useful when testing local .rbxl files that have not been published to Roblox.
To access the DataStoreService in an unpublished place, both DataModel:SetUniverseId() and DataModel:SetPlaceId() must be set.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| universeId | int64 | The ID to set the DataModel.GameId to. |
Returns
| Type | Description |
|---|---|
| () |
| Field | Value |
|---|---|
| security | PluginSecurity |
| thread safety | Unsafe |
Events
| Name | Type / Returns | Description |
|---|---|---|
| DataModel.AllowedGearTypeChanged | Fires when SetGearSettings is called with a different value for allowedGenres. | |
| DataModel.GraphicsQualityChangeRequest | Fires when the user prompts and increase or decrease in graphics quality using the hotkeys. | |
| DataModel.ItemChanged | Fires when a property of any object in the DataModel is changed. | |
| DataModel.Loaded | Fires on the client when the game finishes loading for the first time. | |
| DataModel.ServerRestartScheduled | Fires on the server when the server has been scheduled to restart. Provides the scheduled restart time, source, and custom attributes. |
Inherited from ServiceProvider
| Name | Type / Returns | Description |
|---|---|---|
| ServiceProvider.Close | Fires when the current place is exited. | |
| ServiceProvider.ServiceAdded | Fired when a service is created. | |
| ServiceProvider.ServiceRemoving | Fired when a service is about to be removed. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.AncestryChanged | Fires when the Instance.Parent property of this object or one of its ancestors is changed. | |
| Instance.AttributeChanged | Fires whenever an attribute is changed on the Instance. | |
| Instance.ChildAdded | Fires after an object is parented to this Instance. | |
| Instance.childAdded | ||
| Instance.ChildRemoved | Fires after a child is removed from this Instance. | |
| Instance.DescendantAdded | Fires after a descendant is added to the Instance. | |
| Instance.DescendantRemoving | Fires immediately before a descendant of the Instance is removed. | |
| Instance.Destroying | Fires immediately before (or is deferred until after) the instance is destroyed via Instance:Destroy(). | |
| Instance.StyledPropertiesChanged | Fires whenever any style property is changed on the instance, including when a property is set to nil. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.Changed | Fires immediately after a property of the object changes, with some limitations. |
DataModel.AllowedGearTypeChanged
Deprecated. This item is deprecated . Do not use it for new work.
This event fires when SetGearSettings is called with a different value for allowedGenres.
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
DataModel.GraphicsQualityChangeRequest
Fires when the user prompts an increase or decrease in graphics quality using the hotkeys.
This event fires under the following conditions:
- If the user presses F10, this event fires with a
betterQualityargument oftrue. - If the user presses ShiftF10, this event fires with a
betterQualityargument offalse.
This event does not provide the current graphics quality level or cover all updates to the graphics quality. For example, changes made in the core GUI escape menu are not registered.
You can retrieve a user's SavedQualitySetting using UserGameSettings with the following snippet:
UserSettings():GetService("UserGameSettings").SavedQualityLevel If the user's graphics settings are set to automatic then the SavedQualitySetting will be Automatic. There is currently no way for developers to reliably get the current graphics quality level of a user's machine.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| betterQuality | boolean | Whether the user has prompted an increase (true) or a decrease (false) in graphics quality. |
| Field | Value |
|---|---|
| security | None |
Code samples: View on Creator Hub (DataModel-GraphicsQualityChangeRequest1).
DataModel.ItemChanged
Deprecated. This function has been superseded by Object.Changed, which should be used in new work instead.
This event fires when a property of any object in the DataModel is changed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| object | Instance | ||
| descriptor | string |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
Code samples: View on Creator Hub (DataModel-ItemChanged1).
DataModel.Loaded
This event fires on the client when all initial Instances in the game have finished replicating to the client.
Unless they are parented to ReplicatedFirst, LocalScripts do not run until the game has loaded. The following snippet, run from a LocalScript in ReplicatedFirst yields until the game has loaded:
if not game:IsLoaded() then
game.Loaded:Wait()
end See also:
- Replication order for a more detailed summary of the loading process.
DataModel.Loaded, an event that fires when the game has loadedInstance:WaitForChild(), a function which can be used to wait for an individualInstanceto replicate without having to wait for the whole game to finish loading.
| Field | Value |
|---|---|
| security | None |
DataModel.ServerRestartScheduled
Fires when the server has been scheduled to restart, for example when you restart servers from the Creator Hub or Open Cloud to release an experience update, or when Roblox needs to restart servers for infrastructure maintenance.
You can use this event to inform players on the server of the impending restart. You could then let them save their progress or teleport them to updated servers at the most convenient time for your game.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| restartTime | DateTime | A DateTime indicating when the server is scheduled to shut down. The actual restart may happen slightly after this projected time, but not before. | |
| source | CloseReason | An CloseReason describing what triggered the restart. The value will be CloseReason.DeveloperUpdate for experience updates, and CloseReason.RobloxMaintenance for server maintenance updates. | |
| attributes | Dictionary | A dictionary of developer-supplied metadata associated with the restart. If no attributes are provided, then this will be an empty table. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["ServerCommunication"] |
Code samples: View on Creator Hub (DataModel-ServerRestartScheduled1).
Callbacks
| Name | Type / Returns | Description |
|---|---|---|
| DataModel.OnClose | Tuple | Invoked before the game is shut down. When this callback returns, or the timeout period is hit, the game finishes shutting down. |
DataModel.OnClose
Deprecated. This function is deprecated. It is recommended to use DataModel:BindToClose() instead.
Invoked before the game is shut down. When this callback returns, or the timeout period is hit, the game finishes shutting down.
Returns
| Type | Description |
|---|---|
| Tuple |
| Field | Value |
|---|---|
| tags | ["Deprecated"] |
| security | None |
| thread safety | Unsafe |
Code samples: View on Creator Hub (DataModel-OnClose1).