Why is my Kill Script not working..?

Hey Developers,

I’m currently updating my fighting game, and my Kill script isn’t working? Whenever someone dies, it remains 0… But my death system is working? So why is the death script working and not both?

Below is my game link, feel free to either help with the script or give feedback on the game.
Game: untitled fighting game. - Roblox

local Players = game.Players

local Template = Instance.new 'BoolValue'
Template.Name = 'leaderstats'

Instance.new('IntValue', Template).Name = "Kills"
Instance.new('IntValue', Template).Name = "Deaths"


Players.PlayerAdded:connect(function(Player)
	wait(1)
	local Stats = Template:Clone()
	Stats.Parent = Player
	local Deaths = Stats.Deaths
	Player.CharacterAdded:connect(function(Character)
		Deaths.Value = Deaths.Value + 1
		local Humanoid = Character:FindFirstChild "Humanoid"
		if Humanoid then
			Humanoid.Died:connect(function()
				for i, Child in pairs(Humanoid:GetChildren()) do
					if Child:IsA('ObjectValue') and Child.Value and Child.Value:IsA('Player') then
						local Killer = Child.Value
						if Killer:FindFirstChild 'leaderstats' and Killer.leaderstats:FindFirstChild "Kills" then
							local Kills = Killer.leaderstats.Kills
							Kills.Value = Kills.Value + 1
						end
						return
					end
				end
			end)
		end
	end)
end)

Thank you.

1 Like

Have you checked that all the requirements within the if statements are being met?

2 Likes

Use the parent of the tool to identify the player who causes the kill.

2 Likes

I have not, but thanks.

I’ll go over it again.

1 Like

Thank you so much, means a lot as im working on a fighting game.

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