This isn’t a question about the DataStoreService, it is for the DataStore2 module by @Kampfkarren
I recently made some changes on how my game stores data (i.e. removing an entire key from a table), but since I had the SaveInStudio
option set to true
the old data remained.
This was good for debugging and such (e.g. so I didn’t have to do something again and again to get “500 Coins”).
Now that I have made some changes on how the data is stored, I’m looking to reset each DataStore so that each time I use DataStore:Get(defaultValue)
defaultValue
is returned, not the data that was saved before.
Example
I have a table which holds the default values for each DataStore, like this:
This is the old way of storing the “Fruit” data:
local DefaultDataStoreValues = {
Fruit = {
Blueberry = {Unlocked = true, Amount = 0, InventoryCapacity = 10},
Banana = {Unlocked = false, Amount = 0, InventoryCapacity = 10}
}
}
This is the new way of storing the “Fruit” data:
local DefaultDataStoreValues = {
FruitInventoryCapacity = 10
Fruit = {
Blueberry = {Unlocked = true, Amount = 0},
Banana = {Unlocked = false, Amount = 0}
}
}
How would I erase data from a player (one time only)?