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
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.
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)