Can I reset a player's data who has hacked in my game?

So I have a leaderboard in my game and a player has hacked this way to the top, is there anyway I could reset only his data?

1 Like

Hello, sure you can. If you never worked with DataStores, you can place the script of your datastore here, so I can edit it.

You can do it manually through the Command Bar in Roblox Studio.

warn(game.HttpService:JSONEncode(game.DataStoreService:GetDataStore("PlayerData0"):GetAsync("Player_1538726451")))

:arrow_up: This line of code will print you the player’s entire data. Make sure to edit “PlayerData0” and “Player_1538726451” to whatever you use. I took those as an example.

1 Like

He asked to reset it, so instead you should use :SetAsync()

local DaraStorageService = game:GetService(“DataStoreService”)
local CoinsStore = DaraStorageService:GetDataStore(“CoinsStore”)

– Save Data

game.Players.PlayerRemoving:Connect(function(player)
local Coins = player.leaderstats.Coins
local RSD = player.leaderstats.Speed
local SpeedValueM = player.SpeedValues.SpeedValue
local ST = player.SpeedValues.SpeedToul
local ST1 = player.SpeedTool
local Ext1 = player.Ext1

local playerUserId = player.UserId

local data = {
	Coins = player.leaderstats.Coins.Value;
	RSD = player.leaderstats.Speed.Value;
	SpeedValueM = player.SpeedValues.SpeedValueM.Value;
	ST = player.SpeedValues.SpeedToul.Value;
	Ext1 = player.Ext1.Value;
	ST1 = player.SpeedTool.Value;
	


}


local success, errormessage = pcall(function()
	CoinsStore:SetAsync(playerUserId, data)
end)

if success then
	print("Saved")
	
else
	print("NotSavedError")
	warn(errormessage)
end

end)

game:BindToClose(function()
wait(2)
end)

Is my data storage )