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

Is it possible to delete a user's DataStore?

Asked by 8 years ago

I was wondering if it is possible to delete a user's DataStore, instead of using SetAsync, can anyone tell me if it's possible and if it is, how you would achieve doing it?

1 answer

Log in to vote
2
Answered by
MrNicNac 855 Moderation Voter
8 years ago

DataStore is not per-user. Users do not have their own DataStores. You probably are using the GlobalDataStore from DataStoreService:GetGlobalDataStore(), or maybe even using :GetDataStore(Key).

Either of those will work to obtain a DataStore. You are most likely assigning a key with the player's ID (not username, I hope) and storing things like that.

There is no technical "deletion" of a DataStore. To do a deletion, you would simply empty the value - it is, in almost all hypothetical accounts, the same as deleting the DataStore's key.

Even though you said instead of using SetAsync, you should be using that if you want to empty out the value. It's as simple as:

local DataStore = game:GetService("DataStoreService"):GetDataStore(Player.userId)
DataStore:SetAsync("Inventory", "")
0
Thanks. ISellCows 2 — 8y
Ad

Answer this question