This is a yielding function. When called, it will pause the Lua thread that called the function until a result is ready to be returned, without interrupting other scripts.
Increments the value for a particular key and returns the incremented value. Only works on values that are integers. Note that you can use
GlobalDataStore/OnUpdate|OnUpdate() to execute a function every time the database updates the key’s value, such as after calling this function.
If this function throws an error, the
Articles/Datastore Errors|error message will describe the problem. Note that there are also
Articles/Datastore Errors|limits that apply to this function.
Articles/Data store|Data Stores article for an in-depth guide on data structure, management, error handling, etc.
The key identifying the entry being retrieved from the data store
The increment amount
The value of the entry in the data store with the given key
Increment Data Store
This example uses a data store to increase the value of a key, reflecting how many times a player has visited your game. Because
GlobalDataStore/IncrementAsync|IncrementAsync() returns the incremented value, you can reward the player based on how many times they’ve visited.