I want to clear all the data on my game before release. And i just implemented a code system which wiped my data, but anyway i have to clear all data saved so does anyone know how i clear everyones data?
When you call DataStoreService:GetDataStore(name)
Change the name
to something else
For example:
DataStoreService:GetDataStore("Development")
→
DataStoreService:GetDataStore("Production")
so would i change this:
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("PlayerStats")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats= Instance.new("Folder")
leaderstats.Name= ("leaderstats")
leaderstats.Parent= player
local cash= Instance.new("IntValue")
cash.Name= ("Cash")
cash.Parent = leaderstats
cash.Value = 0
local dmg= Instance.new("IntValue")
dmg.Name= ("Damage")
dmg.Parent = leaderstats
dmg.Value = 1
local shard= Instance.new("IntValue")
shard.Name= ("Shards")
shard.Parent = leaderstats
shard.Value = 0
local zone= Instance.new("IntValue")
zone.Name= ("Zones")
zone.Parent = leaderstats
zone.Value = 0
end)
to:
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("OreSimData")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats= Instance.new("Folder")
leaderstats.Name= ("leaderstats")
leaderstats.Parent= player
local cash= Instance.new("IntValue")
cash.Name= ("Cash")
cash.Parent = leaderstats
cash.Value = 0
local dmg= Instance.new("IntValue")
dmg.Name= ("Damage")
dmg.Parent = leaderstats
dmg.Value = 1
local shard= Instance.new("IntValue")
shard.Name= ("Shards")
shard.Parent = leaderstats
shard.Value = 0
local zone= Instance.new("IntValue")
zone.Name= ("Zones")
zone.Parent = leaderstats
zone.Value = 0
end)
or something along those lines
Yes, that’s correct. You can change "PlayerStats"
to something else that hasn’t been used before to change the data.
Basically just change the name of the DataStore DataStore:GetDataStore("...")
Did changing it reset the data how you wanted?
not sure… i dont think so but it could have
If you want to erase all data from a DataBase so you can use the same Database again but fresh and clean, use the pluggin called DataEditor, now when you open and install the plugin, connect to the DataBase you want to erase and enter as a key the userID or whatever you have wrote inside SetAsync() (which is the key). This will work for test versions of games since you give limited access or you do testing yourself with other 2-3 people you know. It won’t fetch you all the users played but you can search them with the key once you are connected to the DataBase.
Here’s a script that erases all data from all DataStores without any plugin and doesn’t require any names.
local DataStoreService = game:GetService("DataStoreService")
local allDataStorePages = DataStoreService:ListDataStoresAsync()
while true do
local currentDataStoresPage = allDataStorePages:GetCurrentPage()
for _, DataStoreInfo in ipairs(currentDataStoresPage) do
local dataStore = DataStoreService:GetDataStore(DataStoreInfo.DataStoreName)
local allKeysPages = dataStore:ListKeysAsync()
while true do
local currentKeysPage = allKeysPages:GetCurrentPage()
for _, Key in pairs(currentKeysPage) do
dataStore:RemoveAsync(Key.KeyName)
end
if allKeysPages.IsFinished then break end
allKeysPages:AdvanceToNextPageAsync()
end
end
if allDataStorePages.IsFinished then break end
allDataStorePages:AdvanceToNextPageAsync()
task.wait()
end