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)