Skip to content
Roblox API Reference

GlobalDataStore

An object that exposes methods to access a single data store.
  • Not creatable
  • Not replicated
Memory category
Instances
Own members
7
Inherited members
75
Subclasses
2
Siblings
608

Properties23

Inherited fromObject2

Property categoryData

Inherited fromInstance21

Property categoryBehavior

Property categoryData

Property categoryPermissions

Methods49

Inherited fromObject3
  • Get an event that fires when a given property of the object changes.
    Parameters
    ParameterDescription
    property: string
    The property to connect to.
    Returns
    TypeDescription
    RBXScriptSignal
    A signal that fires whenever the property changes.
  • Object:IsA(className: string): boolean
    Returns true if an object's class matches or inherits from a given class.
    • Custom Lua state
    • Thread safe
    Parameters
    ParameterDescription
    className: string
    The class against which the Object's class will be checked. Case-sensitive.
    Returns
    TypeDescription
    boolean
    Describes whether the Object's class matched or is a subclass of the given class.
  • Object:isA(className: string): boolean
    Deprecated: This deprecated function is a variant of Object:IsA() which should be used instead.
    • Deprecated
    • Custom Lua state
    Parameters
    Parameter
    className: string
    Returns
    Type
    boolean

    Use IsA instead.

Inherited fromInstance39
Defined byGlobalDataStore7
  • GlobalDataStore:BatchGetAsync(keys: { any },options: { [string]: any }? = nil,): { [string]: any }
    Returns the values of multiple keys from the data store in a single request.
    • Yields
    • Capabilities: DataStore
    Parameters
    ParameterDescription
    keys: { any }
    An array of key name strings to retrieve. The maximum number of keys per request is determined by a server-side limit (default 100).
    options: { [string]: any }? = nil
    (Optional) Unused; has no effect.
    Returns
    TypeDescription
    { [string]: any }
    A dictionary mapping each requested key (string) to a table containing a value field with the key's current value. Keys that don't exist or have no value are omitted from the result.
  • GlobalDataStore:GetAsync(key: string,options: DataStoreGetOptions? = nil,): ...any
    Returns the value of a key in a specified data store and a DataStoreKeyInfo instance.
    • Yields
    • Capabilities: DataStore
    Parameters
    ParameterDescription
    key: string
    The key name for which the value is requested. If DataStoreOptions.AllScopes was set to true when accessing the data store through DataStoreService:GetDataStore(), this key name must be prepended with the original scope as in "scope/key".
    options: DataStoreGetOptions? = nil
    (Optional) A DataStoreGetOptions instance that controls aspects of the read, such as whether to bypass the locally cached value via its DataStoreGetOptions.UseCache property.
    Returns
    TypeDescription
    ...any
    The value of the entry in the data store with the given key and a DataStoreKeyInfo instance that includes the version number, date and time the version was created, and functions to retrieve UserIds and metadata.
  • GlobalDataStore:IncrementAsync(key: string,delta: number? = 1,userIds: { any }? = {},options: DataStoreIncrementOptions? = nil,): any
    Increments the value of a key by the provided amount (both must be integers).
    • Yields
    • Capabilities: DataStore
    Parameters
    ParameterDescription
    key: string
    Key name for which the value should be updated. If DataStoreOptions.AllScopes was set to true when accessing the data store through DataStoreService:GetDataStore(), this key name must be prepended with the original scope as in "scope/key".
    delta: number? = 1
    Amount to increment the current value by.
    userIds: { any }? = {}
    (Optional) A table of UserIds to associate with the key.
    options: DataStoreIncrementOptions? = nil
    (Optional)DataStoreIncrementOptions instance that combines multiple additional parameters as custom metadata and allows for future extensibility.
    Returns
    TypeDescription
    any
    The updated value of the entry in the data store with the given key.
  • GlobalDataStore:RemoveAsync(key: string): ...any
    Removes the specified key while also retaining an accessible version.
    • Yields
    • Capabilities: DataStore
    Parameters
    ParameterDescription
    key: string
    Key name to be removed. If DataStoreOptions.AllScopes was set to true when accessing the data store through DataStoreService:GetDataStore(), this key name must be prepended with the original scope as in "scope/key".
    Returns
    TypeDescription
    ...any
    The value of the data store prior to deletion and a DataStoreKeyInfo instance that includes the version number, date and time the version was created, and functions to retrieve UserIds and metadata.
  • GlobalDataStore:SetAsync(key: string,value: any,userIds: { any }? = {},options: DataStoreSetOptions? = nil,): any
    Sets the value of the data store for the given key.
    • Yields
    • Capabilities: DataStore
    Parameters
    ParameterDescription
    key: string
    Key name for which the value should be set. If DataStoreOptions.AllScopes was set to true when accessing the data store through DataStoreService:GetDataStore(), this key name must be prepended with the original scope as in "scope/key".
    value: any
    The value that the data store key will be set to.
    userIds: { any }? = {}
    Table of UserIds, highly recommended to assist with GDPR tracking/removal.
    options: DataStoreSetOptions? = nil
    (Optional)DataStoreSetOptions instance that allows for metadata specification on the key.
    Returns
    TypeDescription
    any
    The version identifier of the newly created version. It can be used to retrieve key info using GetVersionAsync() or to remove it using RemoveVersionAsync().
  • GlobalDataStore:UpdateAsync(key: string,transformFunction: (...any) -> ...any,): ...any
    Updates a key's value with a new value from the specified callback function.
    • Yields
    • Capabilities: DataStore
    Parameters
    ParameterDescription
    key: string
    Key name for which the value should be updated. If DataStoreOptions.AllScopes was set to true when accessing the data store through DataStoreService:GetDataStore(), this key name must be prepended with the original scope as in "scope/key".
    transformFunction: (...any) -> ...any
    Transform function that takes the current value and DataStoreKeyInfo as parameters and returns the new value along with optional UserIds and metadata.
    Returns
    TypeDescription
    ...any
    The updated value of the entry in the data store with the given key and a DataStoreKeyInfo instance that includes the version number, date and time the version was created, and functions to retrieve UserIds and metadata.
  • GlobalDataStore:OnUpdate(key: string,callback: (...any) -> ...any,): RBXScriptConnection
    Deprecated: This function has been deprecated and should not be used in new work. You can use the Cross Server Messaging Service to publish and subscribe to topics to receive near real-time updates, completely replacing the need for this function.
    Sets a callback function to be executed any time the value associated with a key is changed.
    • Deprecated
    • Capabilities: DataStore
    Parameters
    ParameterDescription
    key: string
    The key identifying the entry being retrieved from the data store.
    callback: (...any) -> ...any
    The function to be executed any time the value associated with key is changed.
    Returns
    TypeDescription
    RBXScriptConnection
    The connection to the key being tracked for updates.

Events10

Inherited fromObject1
Inherited fromInstance9