Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to erase an entire datastore?

I have this script which I run in run command in studio:

local DSS = game:GetService("DataStoreService")
local DS = DSS:GetDataStore("Quacks")
local suc,err = pcall(function()
    DS:RemoveAsync(--Player's UserId)
end)
if err then
    console.warn(err)
end
if suc then
print("Removed")
end

What it does when run is remove a single player's datastore. How do I make it so this script erase the entire datastore of a game for all players?

5 comments

0

or you could just set all of the player's values to 0 then save the data

0

or make a new data store.

0

Setting all the player's values to 0 isn't the correct way to erase or reset a datastore

0

just change the text inside the parenthesis ':GetDataStore("Quacks")'

0

changing it will create a brand new datastore if a datastore hasn't already been used with that name in your game

1 answer

✓ Accepted answer

You cannot. Change the DataStore title, that's the only way to clear it.

However, you can adopt a verison-structure that refreshes the player's data if there's a version mismatch. Pick your poison.

This discussion is preserved as it was. New answers, comments, and votes are closed.