How do I reset a Hacker's Data?

Hello, I’ll keep it short, A hacker in my game has way more rebirths than possible and I’m trying to reset it. I’ve tried multiple ways, but for some reason it just doesn’t work. Here’s the code.

this is how I save my data.

players.PlayerRemoving:Connect(function(player)
	local key = player.UserId.."-plrdata"
	
	local data = {
		Checkpoints = player.leaderstats.Checkpoints.Value;
		Rebirths = player.leaderstats.Rebirths.Value;
	}
	
	local success, error = pcall(function()
		plrdata:SetAsync(key, data)
	end)
	
	if success then
		print("Sucessfully saved data!")
	end
	
	if error then
		warn(error)
	end
	
end)

this is the code I used to reset the rebirths:

local DataStoreService = game:GetService("DataStoreService")
local plrdata = DataStoreService:GetDataStore("PlrData")

local hackerUserId = 1156965352
local key = hackerUserId.."-plrdata"

local success, err = pcall(function()
	local data = plrdata:GetAsync(key)

	if typeof(data) ~= "table" then
		data = {
			Checkpoints = 0,
			Rebirths = 0
		}
	else
		data.Rebirths = 0
	end

	plrdata:SetAsync(key, data)
	print("Hacker's rebirth count reset successfully.")
end)

if not success then
	warn("Failed to reset hacker's rebirth count:", err)
end
2 Likes

Instead of using code to try reset their data, you should use a datastore editor instead. You can use that plugin to manually change the value.

1 Like

Alternatively just create a simple system for administrators to run a command (ie: !reset (username/userid)) and go with that.

Opening studio to reset one persons data could get super redundant, but making your own admin system for general usage should be pretty useful.

You need only run GobalDataStore:RemoveAsync in your Roblox Studio CLI

I did actually use one that was free, but it wasn’t really too well since I don’t think I managed to change their data. But I will try this, thank you!

I’m definitely going to that soon, right now, my game isn’t filled with hackers, just a couple of them, so manually doing it should be good for now. I appreciate your response though.

Here’s a program

local datastoreservice = game:GetSevice("DataStoreService")
local datastore = datastoreservice:GetDataStore("NAME OF YOUR DATASTORE HERE")

game.Players.PlayerAdded:Connect(function(plyr)
	plyr.Chatted:Connect(function(msg)
		local lowercasemsg = msg:lower()
		local splitmsg = string.split(lowercasemsg," ")

		if splitmsg[1] == "!resetdata" then
			local succ, err = pcall(function()
			--right here include the program to reset your datastores, idk what theyre called or how they're organized
		end)

	end)
end)

Do note I wrote this on the site, didn’t test in studio so please forgive me if it bugs out.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.