Any better way to delete unused DataStores?

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.

Any help, any ideas please? :cry:

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.

4 Likes

Instead of completeling wiping the datastore, just create a new one and import anything you need from the old one.

1 Like

I already have this, but the problem is that it takes way too long (6M+ Keys), and is unreliable due to Roblox’s rate limits on editing DataStores.

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.

Add some pauses and run it when it has time.

1 Like

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.

Then it will take 3 days… Better than doing it by hand for 3 months. You may want to consider a fresh datadase.

1 Like

literally nothing will happen to you if you ignore those messages they are fully automatic lol


you can’t delete a datastore? wow yeah I just looked it up there is no way to delete a datastore that makes no sense