GlobalDataStore

GlobalDataStore : Instance

Overview

The GlobalDataStore class is a fundamental component of the DataStoreService, providing methods for saving and loading data persistently across game sessions. This class is crucial for developers who need to store player data, game states, or other persistent information.

Description

The primary role of the GlobalDataStore is to manage data persistence. It allows developers to save and retrieve data using unique keys, ensuring that information can be accessed across different play sessions and servers.

Properties

Methods

GetAsync

Retrieves the latest value of a specified key along with metadata, such as version information.

Parameters

string InKey

DataStoreGetOptions InOptions

Return

Tuple

Code Samples

IncrementAsync

Increments the numeric value of a key by a specified amount.

Parameters

string InKey

number InDelta

array InUserIds

DataStoreIncrementOptions InOptions

Return

Value

Code Samples

RemoveAsync

Deletes a key from the data store while retaining an accessible version history.

Parameters

string InKey

Return

Tuple

Code Samples

SetAsync

Sets or updates the value for a given key, creating a new version each time it is called.

Parameters

string InKey

Value InValue

array InUserIds

DataStoreSetOptions InOptions

Return

Value

Code Samples

UpdateAsync

Safely updates a key's value by reading its current state before applying changes, useful for handling concurrent modifications.

Parameters

string InKey

Value InTransformFunction

Return

Tuple

Code Samples

Events