How can I have a lot of global leaderboards without exceeding datastore limit?

Yes I’m trying to accomplish that, but when the player change the map, the leaderboard for the new map has to be loaded, thus calling GetSortedAsync()

As I said, you would have extra requests.

If the interval (time gap) between the changing of map is more than one minute, then I don’t see the problem. That is to say if you only get the data when the map changes, not on regular intervals.

Making the time gap more than 1 minute is simple too, because the time gap also includes the minigame being played.

Yes, that works but the owner of the game decided to have the map leaderboards in the UI. Which means the time between each change would be 5 seconds or even less. But if there’s no better solution than this then I guess I’ll have to change them.

How many times do you want to show in each leaderboard, is it the top 5 times, the top 10 times, the top 100 times?

Is it necessary to be in sync? It is not in the owner’s desire for it be delayed for a certain amount of time because of Roblox limitations?

In that case, I cannot help you anymore. I think you should make them change their opinion of changing the leaderboards changing every 5 seconds.

It’s top 10 times

No I don’t think it need to, however it’d be hard to have all the leaderboards initialized upon server creation. Assuming each leaderboard takes around 1 minute to have its data. It’d take hours

I’d be tempted then to not use an orderereddatastore at all, implement a custom top 10 list and store that as a regular key. In there just have a just of user ids and times, some sort of comma separated string. You then avoid the timing constraints of ordered data sets.

You’d need to write a bit of code so that every time someone gets a score you check if they are in the top ten. If so update your top ten key and save it.

Can read out the keys for each map pretty fast as you have the 60* limit not 5* limit for those

6 Likes

My point in the solution is to only request the data of the leaderboard when the map changes, with only getting data from the new map. If the players don’t frequently change the map or are not changing it in less than one minute, then this solution might work.

Are frequent updates necessary?

You could pull data from the Datastore every few minutes (not all at once), and keep a local cache of the data.

This local cache gets updated with the times of players in the server, and sometimes pulls new data from the Datastore.

I think this is the best solution I could get as of right now.

I’ll edit this post in the future once I get the system working (in case future people get the same problem I had).

Anyways thank to:

for contributing to the problem, I wish I could give you all a solution but that’s not possible right now.
I greatly appreciate your efforts in solving this problem! :smiley:

3 Likes

What are your values for the datastore and what is it used for with each map?