How can I script a way to access datastores from multiple games at once?

I co-own a group with 9 published, active games. It’s already annoying enough that Roblox does not tell us which games that a GDPR request is coming from, so I have to manually check them all.

But the other problem is leaderboards - I have a game with a weekly leaderboard, and it creates a new OrderedDataStore every week to track how many kills that every player gets. We also have some updates planned to implement even shorter time spans, like daily leaderboards.

The problem is that each game ends up having hundreds of Datastores over time that could contain a player’s UserId if we want to have an ordered leaderboard. On top of that, Datastores are throttled so I can’t even make a script to run back through every week or day of leaderboards and erase them instantly. And the longer the game exists and the more leaderboard datastores are created, the process becomes even longer each time.

Is there any reasonable way with a script to quickly go through all 9 games at once and potentially hundreds or thousands of datastores to remove instances of a UserId?

2 Likes

I don’t know of a way to go through them all and delete user data, and I’m doubtful one exists. It would be nice if Roblox supported deleting unused data stores. The only solution I see is to use an external database. This would also allow your games to use the same data if desired.

1 Like

You can make a script and run it in the studio command bar to clear the data stores. I don’t know the way you store the data but here is an example I made.

local DataStoreService = game:GetService("DataStoreService")
local pre_key = “Week_”
Local currentWeek = 10

for index = 1, currentWeek do
   local week = pre_key .. index 
   -- Code to remove data for certain week
end