Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i delete or reset a data store ?

Asked by 6 years ago

Before i made a script that hold a datastore called "UserData" and i deleted it (i don't remember why)

and now i remade the script but i can't change the value and when i quit and i join it's always the same value so i tried something like this :

local DS = game:GetService("DataStoreService")
local Data = DS:GetDataStore("UserData")
Data:Destroy()

1 answer

Log in to vote
3
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
6 years ago

You cannot delete all keys from a GlobalDataStore.

You can however delete one specific key using RemoveAsync()

local DS = game:GetService("DataStoreService")
local Data = DS:GetDataStore("UserData")
Data:RemoveAsync("key")

Or if you want to start your datastore fresh, you can simply change the GlobalDataStore key from UserData to something else, like UserData_2

0
Thanks ! xJathur95x 129 — 6y
0
I always set a variable with the version of the datastore, I simply change that value to make a new datastore, is great for testing User#20388 0 — 6y
Ad

Answer this question