How would I go about removing a particular players data in DataStore2? I’m familiar with regular datastores, but I’ve been asked to help a friend out with his already existing game, and I’ve never used DataStore2.
I did find the api:
API - DataStore2
But I’m not sure if ClearCache() removes ALL data or if it’d remove for a particular player.
I’m too scared to try anything on the chance I remove ALL existing data for a game that hundreds of people have data saved on already. This is the only relevant information in the script I believe.
local storage = require(numbers)
local statStore = storage(storeKey, player)
local stats = statStore:Get()
I think :ClearCache() removes the data updated in that playing session.
But I think you can simply remove the players data by doing
Please search for previous posts relating to this as this has been asked various times before.
Nonetheless, here is the answer:
For anyone dealing with GDPR, I believe this script I whipped up will work. Put this in your command bar then use clear(userId, name) (also in the command bar) to clear someone’s data.
If you use combined data stores, the name will be your master key. Otherwise, it’s your normal name.
local DataStoreService = game:GetService("DataStoreService")
function clear(userId, name)
local orderedDataStore = DataStoreService:GetOrderedDataStore(name .. "/" .. userId)
local dataStore = DataStoreService…