RemoveAsync - help with clearing a players leaderstat data

I’m not sure how you clear a players leaderstat data using RemoveAsync, I have looked all around the devforum and non of the scripts seem to be working when pasting it into the command bar and editing it.

Would appreciate some help, just wanting to remove someones leaderstat values because it was cheated to get it.

You should be able to remove a players data directly through the console found in Roblox studio.

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("YOUR_DATA_STORE_NAME") -- Change the string to the name of the DataStore where player data is stored in your game.

--[[ This snippet was taken from DataStore's documentation page.
RemoveAsync returns a tuple that allows you to interact with the data that was removed.
https://developer.roblox.com/en-us/api-reference/function/GlobalDataStore/RemoveAsync
]]

local success, removedValue, keyInfo = pcall(function()
	return DataStore:RemoveAsync("PLAYER_KEY") -- Change this to the key you use to store player data. 
end)
if success then
	print(removedName)
	print(keyInfo.Version)
	print(keyInfo.CreatedTime)
	print(keyInfo.UpdatedTime)
	print(keyInfo:GetUserIds())
	print(keyInfo:GetMetadata())
end

already saw this on some post here, it doesnt work


key is their user id right?

nevermind, i just used this script

game:GetService(“DataStoreService”):GetDataStore(‘CurrencyStore’):RemoveAsync(1204733303)

i had to check my datastore script to find the actual datastore name and not the int value

4 Likes