Players resetting makes kill not count

1. What Im trying to achieve: I want to achieve a system where, if a player has done atleast 30% of someones MaxHP, they will get a reward for it. The script that handles this kill system is a server script located in ServerScriptService. This system does work perfectly, except there is one issue.

2. The issue at hand: When the player who is being attacked resets by doing Esc+R+Enter, the kill does not count anymore, as the server can not detect a player dying by them resetting themselves.

3. Solutions I have tried: Since resetting can be detected by the client, I have tried to instead fire a remote event to the server when the player dies, which then rewards the killer of the player, but this creates the problem where exploiters could simply just disable, edit or delete this local script in order to not let their killer get the reward.

It would be greatly appreciated if anyone can help me in finding a solution for this problem, thank you.

game.Players.PlayerAdded:Connect(function(player)
	
	player.CharacterAdded:Connect(function(chr)
		chr.Humanoid.Died:Connect(function()
			for _, n in pairs(chr.Attackers:GetChildren()) do
				if (n.Value / chr.Humanoid.MaxHealth * 100) >= 30 then
					print("kill registered")
					game.Players[n.Name].Data.PC.Value = game.Players[n.Name].Data.PC.Value + 100 
				end
			end
		end)
	end)
end)

Try to save Attackers not in the character of the player, but in another place, after death or respawn, the data is not deleted, and already when adding a Character (not death), check the killers and then clear them.

1 Like

This sounds like it should work, I’ll be trying this out after I went to sleep, I will tell you the results then.

Thanks for the reply!

if they don’t need to reset for any reason you may just want to disable the reset button with something like this

-- Roblox Services
local StarterGUI = game:GetService("StarterGui")
-- Disables the Reset Button
repeat 
	local success = pcall(function() 
		StarterGUI:SetCore("ResetButtonCallback", false) 
	end)
	task.wait(1)
until success
1 Like

It worked! Thank you a lot for the reply.

1 Like

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