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?
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", "")