# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: DataModel
type: class
memory_category: Instances
summary: |
The root of Roblox's parent-child hierarchy. Its direct children are services,
such as `Class.Workspace` and `Class.Lighting`, that act as the fundamental
components of a Roblox game.
description: |
The [Data Model](../../../projects/data-model.md) (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
`Class.Workspace` and `Class.Lighting`, that act as the fundamental components
of a Roblox game.
code_samples:
- DataModel1
inherits:
- ServiceProvider
descendants: []
tags:
- NotCreatable
deprecation_message: ''
properties:
- name: DataModel.CreatorId
summary: |
Describes the ID of the user or group that owns the place.
description: |
This property describes the ID of the user or group that owns the place.
If the `Class.DataModel.CreatorType` property is `User` then `CreatorId`
will be the `Class.Player.UserId` of the place's owner. If the
`Class.DataModel.CreatorType` is `Group` then `CreatorId` will be the ID
of the group that owns the place.
code_samples:
- detect-when-the-place-owner-joins-the-game
type: int64
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: State
serialization:
can_load: false
can_save: false
capabilities: []
- name: DataModel.CreatorType
summary: |
Describes the `Enum.CreatorType` of the place, whether the place is owned
by a user or a group.
description: |
This property describes the `Enum.CreatorType` of the place, whether the
place is owned by a user or a group. If `User`, then the
`Class.DataModel.CreatorId` property will describe the
`Class.Player.UserId|UserId` of the account that owns the game. If
`Group`, then it will describe the group ID.
code_samples:
- detect-when-the-place-owner-joins-the-game
type: CreatorType
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: State
serialization:
can_load: false
can_save: false
capabilities: []
- name: DataModel.GameId
summary: |
Describes the ID of the experience that the place running on the server
belongs to.
description: |
This property describes the ID of the experience that the place running on
the server belongs to.
#### See Also
- `Class.DataModel.PlaceId`, which describes the ID of the place running
on the server
- `Class.DataModel.JobId`, which is a unique identifier for the server
game instance running
- `Class.TeleportService`, which is a service that can be used to
transport `Class.Player|Players` between games
code_samples: []
type: int64
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: State
serialization:
can_load: false
can_save: false
capabilities: []
- name: DataModel.GearGenreSetting
summary: |
Not functional. Historically described the gear permissions of the place
as set on the Roblox website.
description: |
This property, along with `Class.DataModel.Genre`, no longer functions
correctly and attempting to read it may throw an error.
code_samples: []
type: GearGenreSetting
tags:
- ReadOnly
- NotReplicated
- Deprecated
deprecation_message: |
This property is deprecated and is no longer functional. It should not be
used.
security:
read: None
write: None
thread_safety: ReadSafe
category: State
serialization:
can_load: false
can_save: false
capabilities: []
- name: DataModel.Genre
summary: |
Not functional. Historically described the `Enum.Genre` of the place as
set on the Roblox website.
description: |
This property is broken and should not be used.
This property historically described the `Enum.Genre` of the place as set
on the Roblox website.
This property, along with `Class.DataModel.GearGenreSetting`, no longer
functions correctly due to genres existing on the Roblox website that are
not reflected in the `Enum.Genre` enum. As a result, attempting to read
this property may throw an error.
code_samples: []
type: Genre
tags:
- ReadOnly
- NotReplicated
deprecation_message: |
This property is deprecated and is no longer functional. It should not be
used.
security:
read: None
write: None
thread_safety: ReadSafe
category: State
serialization:
can_load: false
can_save: false
capabilities: []
- name: DataModel.JobId
summary: |
A unique identifier for the running game server instance.
description: |
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
- `Class.TeleportService:GetPlayerPlaceInstanceAsync()` which can be used
to retrieve the `Class.DataModel.JobId` of a user's current server.
- `Class.TeleportService:TeleportToPlaceInstance()` which can be used to
teleport a `Class.Player` to a specific server.
- `Class.DataModel.PrivateServerId` describes the ID of the private server
the game server instance belongs to.
- `Class.HttpService:GenerateGUID()`, a function that can be used to
generate your own UUIDs.
code_samples: []
type: string
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: JobInfo
serialization:
can_load: false
can_save: false
capabilities: []
- name: DataModel.lighting
summary: |
Refers to the game's `Class.Lighting` service.
description: |
This property was once used to get the game's `Class.Lighting` service.
code_samples: []
type: Instance
tags:
- ReadOnly
- NotReplicated
- Deprecated
deprecation_message: |
This item has been superseded by
`Class.ServiceProvider:GetService()|game:GetService("Lighting")`, which
should be used instead.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities: []
- name: DataModel.MatchmakingType
summary: |
Represents how players in the server are handled by matchmaking.
description: |
This property represents how players in the server are handled by
matchmaking. Players with different
`Class.DataModel.MatchmakingType|MatchmakingTypes` cannot be in or
teleport to the same server.
Note that this property is only valid on the server `Class.DataModel` and
it will be the `Enum.MatchmakingType.Default` value for all clients, so
only reference this property inside of a server‑side `Class.Script`.
code_samples: []
type: MatchmakingType
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: true
capabilities: []
- name: DataModel.PlaceId
summary: |
Describes the ID of the place running on the server.
description: |
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
- `Class.DataModel.GameId`, which describes the ID of the experience that
the current place belongs to
- `Class.DataModel.JobId`, which is a unique identifier for the server
game instance running
- `Class.TeleportService`, which is a service that can be used to
transport `Class.Player|Players` between places
code_samples: []
type: int64
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: State
serialization:
can_load: false
can_save: false
capabilities: []
- name: DataModel.PlaceVersion
summary: |
Describes the version of the place the server is running on.
description: |
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 `Class.ScreenGui` showing the
current version of the game to `Class.Player|Players` to assist with
debugging.
code_samples:
- server-version-number-gui
type: int
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: State
serialization:
can_load: false
can_save: false
capabilities: []
- name: DataModel.PrivateServerId
summary: |
Describes the private server ID of the server, if the server is a private
server or a `Class.TeleportService:ReserveServerAsync()|reserved server`.
description: |
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](../../../production/monetization/private-servers.md)
that users can purchase from the games page
- Reserved servers, private servers created by the developer using
`Class.TeleportService:ReserveServerAsync()`
#### PrivateServerId vs JobId
The PrivateServerId of a server is different from the
`Class.DataModel.JobId`. The `Class.DataModel.JobId|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 `Class.DataModel.JobId` will be unique for each one.
See also:
- `Class.DataModel.PrivateServerOwnerId`, a property describing the owner
of a private server
- `Class.TeleportService:ReserveServerAsync()`, a function which creates a
reserved server
code_samples:
- detecting-private-servers
type: string
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: true
capabilities: []
- name: DataModel.PrivateServerOwnerId
summary: |
Describes the `Class.Player.UserId|UserId` of the `Class.Player` that owns
the private server if the server is private.
description: |
This property describes the `Class.Player.UserId|UserId` of the
`Class.Player` that owns the
[private server](../../../production/monetization/private-servers.md) 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 `Class.Player` is the owner
of the private server, for example:
```lua
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:
- `Class.DataModel.PrivateServerId`, a property describing the unique ID
of private and
`Class.TeleportService:ReserveServerAsync()|reserved servers`
code_samples:
- detecting-private-servers
type: int64
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: true
capabilities: []
- name: DataModel.RunService
summary: |
A reference to the `Class.RunService` service.
description: |
A reference to the `Class.RunService` service. Always points to
`Class.RunService` and is never `nil`. You can also retrieve it with
`Class.ServiceProvider:GetService()|GetService()`, for example
`game:GetService("RunService")`.
code_samples: []
type: RunService
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities: []
- name: DataModel.VIPServerId
summary: |
A string that could identify the current server as a private server.
description: |
This property was string that could identify the current server as a
private server.
code_samples: []
type: string
tags:
- Hidden
- ReadOnly
- NotReplicated
- Deprecated
deprecation_message: |
This property has been deprecated. Use `Class.DataModel.PrivateServerId`
instead.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: true
capabilities: []
- name: DataModel.VIPServerOwnerId
summary: |
The `Class.Player.UserId|UserId` of the account who owns the private
server.
description: |
This property indicates the `Class.Player.UserId|UserId` of the account
who owns the private server.
code_samples: []
type: int64
tags:
- Hidden
- ReadOnly
- NotReplicated
- Deprecated
deprecation_message: |
This property has been deprecated. Use
`Class.DataModel.PrivateServerOwnerId` instead.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: true
capabilities: []
- name: DataModel.Workspace
summary: |
A reference to the `Class.Workspace` service.
description: |
This property is a reference to the `Class.Workspace` service. It always
points to `Class.Workspace` and will never be `nil`.
code_samples: []
type: Workspace
tags:
- ReadOnly
- NotReplicated
deprecation_message: ''
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities: []
- name: DataModel.workspace
summary: ''
description: ''
code_samples: []
type: Workspace
tags:
- ReadOnly
- NotReplicated
- Deprecated
deprecation_message: |
This deprecated property is a variant of `Class.DataModel.Workspace` which
should be used instead.
security:
read: None
write: None
thread_safety: ReadSafe
category: Data
serialization:
can_load: false
can_save: false
capabilities: []
methods:
- name: DataModel:BindToClose
summary: |
Binds a function to be called before the server shuts down.
description: |
Binds a function to be called before the server shuts down. If the bound
function accepts a parameter, it passes `Enum.CloseReason` specifying the
reason for the server shutdown.
You can bind multiple functions by calling
`Class.DataModel:BindToClose()|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
`Class.RunService:IsStudio()`. This prevents bound functions from
completing their run in offline testing sessions.
When you use `Class.DataStoreService`, you should also use `BindToClose`
to bind a function saving all unsaved data to
`Class.GlobalDataStore|DataStores`. This prevents data loss if the server
shuts down unexpectedly.
See also:
- `Enum.CloseReason` for reasons for the experience server shutdown.
- `Class.PluginGui:BindToClose()`, which binds a function to a
`Class.PluginGui` close button.
code_samples:
- saving-player-data-before-shutting-down
- DataModel-BindToClose1
parameters:
- name: function
type: Function
default:
summary: |
A function called before the experience server shuts down. If the
bound function accepts a parameter, it passes `Enum.CloseReason`
specifying the reason for the server shutdown.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: DataModel:GetJobsInfo
summary: |
Returns a table containing basic information about the jobs performed by
the task scheduler.
description: |
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:
```lua
{
["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:
```lua
{
["name"] = "Heartbeat",
["averageDutyCycle"] = 0,
["averageStepsPerSecond"] = 0,
["averageStepTime"] = 0,
["averageError"] = 0,
["isRunning"] = false,
}
```
See also:
- `Class.TaskScheduler`
code_samples:
- DataModel-GetJobsInfo1
parameters: []
returns:
- type: Array
summary: |
A table containing information about the jobs performed by the task
scheduler, see above for the format.
tags: []
deprecation_message: ''
security: PluginSecurity
thread_safety: Unsafe
capabilities: []
- name: DataModel:GetMessage
summary: |
**_[OBSOLETE]:_** This function will always return a blank string.
description: |
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.
code_samples: []
parameters: []
returns:
- type: string
summary: ''
tags:
- Deprecated
deprecation_message: |
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.
security: None
thread_safety: Unsafe
capabilities: []
- name: DataModel:GetObjects
summary: |
Returns an array of `Class.Instance|Instances` associated with the given
content URL.
description: |
This method returns an array of `Class.Instance|Instances` associated with
the given content URL. It can be used to insert content from the Roblox
library. It's not possible to insert `Class.Sound|Sounds` using this
method as they do not have an `Class.Instance` associated with them and
have only a content URL.
Unlike `Class.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
`Class.Script|Scripts` and `Class.LocalScript|LocalScripts`, see
`Class.InsertService:LoadAsset()`.
code_samples:
- view-a-plugin-s-source-code
- batch-convert-decal-web-urls-to-image-content-ids
parameters:
- name: url
type: ContentId
default:
summary: |
The given content URL.
returns:
- type: Instances
summary: |
An array of `Class.Instance|Instances` associated with the content
URL.
tags: []
deprecation_message: |
This item is deprecated. Do not use it for new work.
security: PluginSecurity
thread_safety: Unsafe
capabilities: []
- name: DataModel:GetRemoteBuildMode
summary: |
This method is no longer useful and will always return false.
description: |
This method is no longer useful and will always return false. Use
`Class.RunService:IsServer()` to see if your code is running on the
server.
code_samples: []
parameters: []
returns:
- type: boolean
summary: ''
tags:
- Deprecated
deprecation_message: |
This item is deprecated. Use `Class.RunService:IsServer()` to see if your
code is running on the server.
security: None
thread_safety: Unsafe
capabilities: []
- name: DataModel:IsGearTypeAllowed
summary: |
Returns whether gear of the given `Enum.GearType` is permitted to be added
to `Class.Player|Players'` `Class.StarterGear|StarterGears`.
description: |
Currently this function only returns the correct value on the client
This function returns whether gear of the given `Enum.GearType` is
permitted to be added to `Class.Player|Players'`
`Class.StarterGear|StarterGears`. For example:
```lua
local meleeWeaponsAllowed = game:IsGearTypeAllowed(Enum.GearType.MeleeWeapons)
```
Whether gear of a specific `Enum.GearType` is permitted in the game is
determined in a place's settings page under 'Permissions'. Note, all of a
gear's associated `Enum.GearType|GearTypes` must be enabled for it to be
permitted in a place.
code_samples: []
parameters:
- name: gearType
type: GearType
default:
summary: |
The given `Enum.GearType`.
returns:
- type: boolean
summary: |
Whether gear of the given `Enum.GearType` is permitted in the game.
tags:
- Deprecated
deprecation_message: |
This property is deprecated and is no longer functional. It should not be
used.
security: None
thread_safety: Unsafe
capabilities: []
- name: DataModel:IsLoaded
summary: |
Returns true if the client has finished loading the game for the first
time.
description: |
When all initial `Class.Instance|Instances` in the game have finished
replicating to the client, this function returns true.
Unless they are parented to `Class.ReplicatedFirst`,
`Class.LocalScript|LocalScripts` do not run until the game has loaded. The
following snippet, run from a `Class.LocalScript` in
`Class.ReplicatedFirst` yields until the game has loaded:
```lua
if not game:IsLoaded() then
game.Loaded:Wait()
end
```
See also:
- [Replication order](../../../scripting/attributes.md#replication-order)
for a more detailed summary of the loading process.
- `Class.DataModel.Loaded`, an event that fires when the game has loaded
- `Class.Instance:WaitForChild()`, a function which can be used to wait
for an individual `Class.Instance` to replicate without having to wait
for the whole game to finish loading.
code_samples:
- Custom-Loading-Screen
parameters: []
returns:
- type: boolean
summary: |
Whether the client has finished loading the game for the first time.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities: []
- name: DataModel:SavePlace
summary: |
Saves the current place.
description: |
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.
code_samples: []
parameters:
- name: saveFilter
type: SaveFilter
default: SaveAll
summary: ''
returns:
- type: boolean
summary: ''
tags:
- Yields
- Deprecated
deprecation_message: |
This item is deprecated. Do not use it for new work.
security: None
thread_safety: Unsafe
capabilities: []
- name: DataModel:SetPlaceId
summary: |
Sets the `Class.DataModel.PlaceId` of the current game instance.
description: |
This function sets the `Class.DataModel.PlaceId` of the game instance to
the given `placeId`.
code_samples: []
parameters:
- name: placeId
type: int64
default:
summary: |
The ID to set the `Class.DataModel.PlaceId` to.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: PluginSecurity
thread_safety: Unsafe
capabilities: []
- name: DataModel:SetUniverseId
summary: |
Sets the `Class.DataModel.GameId` of the current game instance to the
given `universeId`.
description: |
This function sets the `Class.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 `Class.DataStoreService` in an unpublished place, both
`Class.DataModel:SetUniverseId()` and `Class.DataModel:SetPlaceId()` must
be set.
code_samples: []
parameters:
- name: universeId
type: int64
default:
summary: |
The ID to set the `Class.DataModel.GameId` to.
returns:
- type: ()
summary: ''
tags: []
deprecation_message: ''
security: PluginSecurity
thread_safety: Unsafe
capabilities: []
events:
- name: DataModel.AllowedGearTypeChanged
summary: |
Fires when SetGearSettings is called with a different value for
`allowedGenres`.
description: |
This event fires when SetGearSettings is called with a different value for
`allowedGenres`.
code_samples: []
parameters: []
tags:
- Deprecated
deprecation_message: |
This item is deprecated . Do not use it for new work.
security: None
capabilities: []
- name: DataModel.GraphicsQualityChangeRequest
summary: |
Fires when the user prompts and increase or decrease in graphics quality
using the hotkeys.
description: |
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
`betterQuality` argument of `true`.
- If the user presses ShiftF10, this event fires
with a `betterQuality` argument of `false`.
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 `Enum.SavedQualitySetting` using
`Class.UserGameSettings` with the following snippet:
```lua
UserSettings():GetService("UserGameSettings").SavedQualityLevel
```
If the user's graphics settings are set to automatic then the
`Enum.SavedQualitySetting` will be
`Enum.SavedQualitySetting.Automatic|Automatic`. There is currently no way
for developers to reliably get the current graphics quality level of a
user's machine.
code_samples:
- DataModel-GraphicsQualityChangeRequest1
parameters:
- name: betterQuality
type: boolean
default:
summary: |
Whether the user has prompted an increase (_true_) or a decrease
(_false_) in graphics quality.
tags: []
deprecation_message: ''
security: None
capabilities: []
- name: DataModel.ItemChanged
summary: |
Fires when a property of any object in the `Class.DataModel` is changed.
description: |
This event fires when a property of any object in the `Class.DataModel` is
changed.
code_samples:
- DataModel-ItemChanged1
parameters:
- name: object
type: Instance
default:
summary: ''
- name: descriptor
type: string
default:
summary: ''
tags:
- Deprecated
deprecation_message: |
This function has been superseded by `Class.Object.Changed`, which should
be used in new work instead.
security: None
capabilities: []
- name: DataModel.Loaded
summary: |
Fires on the client when the game finishes loading for the first time.
description: |
This event fires on the client when all initial `Class.Instance|Instances`
in the game have finished replicating to the client.
Unless they are parented to `Class.ReplicatedFirst`,
`Class.LocalScript|LocalScripts` do not run until the game has loaded. The
following snippet, run from a `Class.LocalScript` in
`Class.ReplicatedFirst` yields until the game has loaded:
```lua
if not game:IsLoaded() then
game.Loaded:Wait()
end
```
See also:
- [Replication order](../../../scripting/attributes.md#replication-order)
for a more detailed summary of the loading process.
- `Class.DataModel.Loaded`, an event that fires when the game has loaded
- `Class.Instance:WaitForChild()`, a function which can be used to wait
for an individual `Class.Instance` to replicate without having to wait
for the whole game to finish loading.
code_samples: []
parameters: []
tags: []
deprecation_message: ''
security: None
capabilities: []
- name: DataModel.ServerRestartScheduled
summary: |
Fires on the server when the server has been scheduled to restart.
Provides the scheduled restart time, source, and custom attributes.
description: |
Fires when the server has been scheduled to restart, for example when you
restart servers from the Creator Hub or
[Open Cloud](https://create.roblox.com/docs/cloud/reference/features/universes#Restarts_LaunchRestart)
to [release an experience update](../../../projects/update-games.md), 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.
code_samples:
- DataModel-ServerRestartScheduled1
parameters:
- name: restartTime
type: DateTime
default:
summary: |
A `Datatype.DateTime` indicating when the server is scheduled to shut
down. The actual restart may happen slightly after this projected
time, but not before.
- name: source
type: CloseReason
default:
summary: |
An `Enum.CloseReason` describing what triggered the restart. The value
will be `Enum.CloseReason.DeveloperUpdate` for experience updates, and
`Enum.CloseReason.RobloxMaintenance` for server maintenance updates.
- name: attributes
type: Dictionary
default:
summary: |
A dictionary of developer-supplied metadata associated with the
restart. If no attributes are provided, then this will be an empty
table.
tags: []
deprecation_message: ''
security: None
capabilities:
- ServerCommunication
callbacks:
- name: DataModel.OnClose
summary: |
Invoked before the game is shut down. When this callback returns, or the
timeout period is hit, the game finishes shutting down.
description: |
Invoked before the game is shut down. When this callback returns, or the
timeout period is hit, the game finishes shutting down.
code_samples:
- DataModel-OnClose1
parameters: []
returns:
- type: Tuple
summary: ''
tags:
- Deprecated
deprecation_message: |
This function is deprecated. It is recommended to use
`Class.DataModel:BindToClose()` instead.
security: None
thread_safety: Unsafe
capabilities: []
writeCapabilities: []