Tool not adding kills

Hello devs!

Today I’ve finished a good part of my weapon finished. This includes melee, firing etc. But we have noticed the past few days that when yo kill someone with the bullet or the bayonet it doesn’t add a kill to the leaderboard.

Is there anyway to make the tool register the kill.

Any help loved!

NOTE THAT THE TOOL IS ALL MORTOR6DS AND ETC

3 Likes

Can you please provide a script, and any other additional info like errors. Always proved enough info for others to help

2 Likes

No errors, and the code has 300 lines of just animation scripting and variables changes.

1 Like

Do you mean like that https://gyazo.com/afa8c90e34b08ed7c9dbb5efad3a993a ?

2 Likes

Yes, when you kill the player it doesnt add.

1 Like

Did you try kill.Value = kill.Value + 1?

1 Like

I wanted to but im confused where I add this.

1 Like

I’m not supposed to write the code for you but here the code.

local p = game.Players.LocalPlayer
local m = p:GetMouse()
script.Parent.Activated:Connect(function()
	local part = Instance.new("Part")
	part.Parent = workspace
	part.Position = m.Hit.p
	part.Touched:Connect(function(Hu)
		if Hu.Parent:FindFirstChild"Humanoid" then
			if Hu.Parent.Humanoid.Health == 0 then
				
			else
				script.Parent.Shot:FireServer(part , Hu)	
			end
		end
		
		part:Destroy()
	end)
end)

That is local script
Above is local script and under is script.

script.Parent.Shot.OnServerEvent:Connect(function(pl , Part , Hu)
		if Hu.Parent:FindFirstChild("Humanoid") then

			Hu.Parent.Humanoid:TakeDamage(10)
			if Hu.Parent.Humanoid.Health <= 0 then
				local leaderstats = pl:FindFirstChild("leaderstats")
				local Kills = leaderstats:FindFirstChild("Kills")
				Kills.Value = Kills.Value + 1
			end
		end
end)

that is the script. You can mess up with the code on your style.

2 Likes

What this code block does is that it if Kills.Value is anything but 0 then it does not run further. That is why your Kills.Value does not increase (after the first kill). Is this supposed to be intended behaviour?

1 Like

I added that on mistake I apologize.

1 Like

There is absolutely nothing to apologize for. :smile:

Could you test if the Kills Value increases on your leaderboard now?

1 Like

Here fixed the script all should be fine for now.

1 Like