I need help deleting entire DataStores. Right now, the tools that Roblox provides are pretty limited, atleast I couldn’t find anything related or good enough to wiping entire DataStores.
My game has a huge list of UserIds which was due to an a free model Admin Commands Script, but I’ve deleted it. Now all that’s left is to delete/wipe the HUGE DataStore containing the UserIds so I don’t have to worry about Right-of-Erasure in the future. The only problem is that I don’t know how to do this reliably.
Right now, I have a script in the game that goes through each key individually and deletes them. This is a VERY, VERY LONG process, which doesn’t work sometimes due to Roblox’s rate limits. I’m tired of deleting every key manually because I also don’t understand how to automate it.
local ds = game:GetService("DataStoreService"):GetOrderedDataStore("MyStore")
local pages = ds:GetSortedAsync(false, 100)
while true do
for _, item in ipairs(pages:GetCurrentPage()) do
ds:RemoveAsync(item.key)
end
if pages.IsFinished then break end
pages:AdvanceToNextPageAsync()
end
This is for something else. I changed it to remove keys. Not tested.
I don’t want to create a new DataStore because I don’t need one anymore. I want to wipe old, unused DataStores efficiently so I don’t have to worry about future Right-Of-Erasure requests and manually deleting the keys.
But regardless of whether I add pauses or not, the loop would be too slow. Looping through 6M+ keys at a pace of 0.05 seconds per key would take a bit over 3 days. Adding pause would slow it down even more.