Why is this script giving the person that got killed KOs aswell as me?

this is the script:

script.Parent.Handle.Touched:Connect(function(touch)

if script.Parent.CanDamage.Value == true then
	
	if not touch.Parent:FindFirstChild("Humanoid") then return end
	
	script.Parent.CanDamage.Value = false
	
	if touch.Parent.Humanoid.Health < 1 then
		
		local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
		plr.leaderstats.KOs.Value = plr.leaderstats.KOs.Value + 1
	end
	
	wait(1)
	
	script.Parent.CanDamage.Value = true
end

end)

4 Likes

Why are you getting the player of the tools parent? That is probably why you are getting the KOs.
If that is intended, however, then please let me know. But from the small amount of stuff I’ve been given, that appears to be your issue. Try changing that line to game.Players:GetPlayerFromCharacter(touch.Parent).


Dunno if you edited your post or something saying I’m replying to this over a year later.