Deleting All Datastore Data

I’ve made a datastore script for all of my data. The issue is that I removed an Item that I had before. Now, the players who played in the previous version of the game have that data, and so it errors, breaking the datastore script for the entire server.

How can I reset ALL of the datastores, as if a wiped slate? Without creating an entirely new experience and copying it over.

1 Like

Create a NEW DataStore.

You can call your DataStore whatever you want.

So see what you have it named now and give it a new name.

I don’t want it to have a new name, I want it wiped clean. I no longer want the old version, that some users are running on. Which is why it breaks.

You decide what DataStore loads, not the players.

So give your DataStore a new name and tell it to load the new name.

So, you are wiping out the old one by not using it.

You cant delete a datastore, what @mc7oof is saying is to just create a new one (by just giving it a new name), so everyones data will be wiped since they are not on the old datastore anymore.

can’t you change the datastore’s keyword?

That’s not how my script has been designed, it currently makes the data based on how it was binded. So, it doesn’t run off of a keyword.

It really sucks how creators don’t have more mobility to access datastores.

local DataStoreService = game:GetService("DataStoreService")
local datastore = DataStoreService:GetDataStore("DatastoreName") <-- this is its name

Changing its name will just switch your game to a new datastore (meaning old one will still exist, but no one will be able to access it).

It’s just like trying to delete an old game, or any asset that you have ever uploaded.

Go ahead, try it! :grinning:

1 Like

If you want to delete people’s data in bulk, without changing where the data is being stored, I would recommend using the DataStore Editor - Roblox on Roblox. Although it costs robux, it saves time having to delete the data individually or having to set a new datastore from scratch. Correct me if it doesn’t delete them all individually, but I wouldn’t see any reason why it couldn’t.

Not sure why you wouldn’t want to create a new datastore though.

1 Like

You should be versioning the data you save, so that when players with the “old” data type join, you can easily handle converting their old data format into your new data format

instead of deleting, perhaps migrating the data through something like this when a player joins would help?:

if not playerData.isNewVersion then
    playerData = ...newdatatype
end
1 Like

You could try the data to nil. Instead of saving the value change it to nil.

I found a workaround to things, thank you all for your help!

Post your solution on this topic, so this post can help others too. :slight_smile:

@Tellygum
Any chance you would kindly share your workaround for this? I am having the same issue.

You can just change the name of the data store to run on an entirely fresh one.

Alot of people have surprisingly ignored the fact that you can use a simple method to remove everyone’s data:

local Page = Datastore:ListKeysAsync()
local Pages = Page:GetCurrentPage()

for _, KeyInstance in Pages do
Datastore:RemoveAsync(KeyInstance.KeyName)
end

Roblox also recommends you limit how many datastores you create, so creating a whole new one would be a bad idea.

I mgiht make a tutorial on this since I’m surprised this many people don’t know.

2 Likes