Working with ordered data stores
In the previous sections, we have worked with regular data stores. However, sometimes we want to make a leaderboard with the wealthiest players for our game. It is going to be very difficult to load all the data for all the players that played our game from these regular data stores. Luckily, there is a different type of data store, ordered data stores.
As the name implies, these ordered data stores have the ability to order all the data. This means we can use a single function to get the top 25 players. Since it is another data store, we have to use the :SetAsync()
function to fill this ordered data store. Because this entire data store is just for a leaderboard, there is no need to save this every 20 seconds. It is enough to update this when the player leaves. After all, there can be no data loss, as it is simply a copy of the real data store.
Important note
Never use the :UpdateAsync()
function when using ordered data stores. As mentioned...