Rocket Launcher Kill Won't Count as a KO using Leaderstats

Hi, I’m currently working on Rocket Arena, as I’m planning on re-making it. Everything is going smoothly until I started to work on the KO system.

What I thought at first was the old Leader stats was outdated, so I re-worked everything out. I went to play-test by using the 2-Player local server and then blew up the other player, but I did not count as a KO.

Would anyone kindly help me on why it isn’t counting as a KO? Roblox is picking up that the player is getting hit but won’t add a KO to the player’s leader stat.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function()
		local Humanoid = player.Character:WaitForChild("Humanoid")
		Humanoid.Died:Connect(function()
			local DamageDealer = Humanoid:FindFirstChild("creator")
			if DamageDealer and DamageDealer.Value then
				local Killer = game.Players:FindFirstChild(DamageDealer.Value.Name)
				if Killer and Killer.leaderstats then
					local kills = Killer.leaderstats:FindFirstChild("KOs")
					if kills then kills.Value = (kills.Value or 0)+1 end
				end
			end
		end)
	end)
end)

This is only showing my KO-Handler script, but if you would like to see my Leaderstats script, I will post it as a reply.

2 Likes

You should put a module for handling leaderstats, and in the server script that deals damage, check if the new health is below zero and the old one wasn’t, and then have that add a KO to the attacker.

When you say module, do you mean as a ModuleScript?

Yes, use a ModuleScript to handle the leaderstats. And in the script that handles damage from a rocket launcher, have it add a KO if the target dies.