How many ordered data stores a game can have? is there a limit?

I have a weekly leaderboard in my game so i think it would be easier and more efficient to change it’s name every week instead of looping through all the keys and removing them (of course if there is no limit to the number of OrderedDataStores)

i think theres no limit for how many you can have

You don’t need to

Just update the data key each week and write new values
Or use DataStoreManager

Just update the data key each week and write new values

i couldnt follow you, what do you mean by update the data key? setting all the key’s values to 0?

Yes you can do that too, in your code, every week (via code), set all values in the datastore to 0 and reupdate the leaderboard when player gets stats

although im not sure why do you have seperate leaderboard key

An easy way to fix this without creating multiple datastores is only saving the values that have a chance of appearing on the leaderboard. For example the values that rank as top 200 on it. That way it will be much easier to reset the leaderboard because you will have to loop through much fewer keys.

Although that might be in cost of other functionality, for example the ability to show the user their position at the leaderboard (if it is below the limit, for example below 200).

this wouldnt work, players should be able to see their own score

isnt this a bit too burdensome?

No, a could script can easily check if it’s the 7th day of the week and the time is 10PM, then function that clears the leaderboard keys runs.

yeah but there will be thousands of keys, idk it sounds like it will be hard for the API to the handle that much request

maybe removing the keys using RemoveAsync() would help a bit? the script will deal with the data of those who played the game last week

You don’t need to, just get top 50 players by their data sorted

all players datas need to be removed

https://create.roblox.com/docs/reference/engine/classes/DataStorePages
roblox literally has example on leaderboards…

So?

If i do this, then 51th player will be the first so resetting wouldnt mean anything

do you even know what u are talking about?

you wouldnt create a new key, you just get top 50 players sorted, and display them, don’t save it, this is one time only

How am i supposed to create a leaderboard and displaying player’s data WITHOUT saving it? Data will just disappear when they leaved?

jesus chirst bro…

you litearlly mentioned having a seperate key for LEADERBOARd, and im saying to NOT do that for christs sakes

I was just asking if it would be less efficient than letting a script clear hundreds of thousands keys. Im not sure about how this would effect the API, thats why i opened this topic

And in case you dont know, DataStore’s name are NOT called “key”. If you say “key” people will likely understand it as a key inside the DataStore. Like
[“Player_1”] = 120
“Player_1” is key here