So I was trying to create a simple knife for a game that I was working on. Everything was going smoothly until I noticed a flaw in the damage system. Every time you hit something with a humanoid, the next time you hit something else with a humanoid your damage will do more than it is supposed to. Nothing in the output is being shown. BTW its a server side script using remote event triggers. The errors are around line 13-27.

The Code:

game.ReplicatedStorage.Shank.OnServerEvent:Connect(function(player, damageblade)
	local idleanime = Instance.new("Animation")
    idleanime.AnimationId = "rbxassetid://3789083756"
    local hum = player.Character.Humanoid
    local idleloader = hum:LoadAnimation(idleanime)
    idleloader:Stop()
	local anime = Instance.new("Animation")
	anime.Name = "Shanker"
    anime.AnimationId = "rbxassetid://3789143130"
    local loader = hum:LoadAnimation(anime)

local touchedalready = false
	hum.AnimationPlayed:Connect(function(animationTrack)
		if animationTrack.Animation.Name == "Shanker" then
			local hit = damageblade:GetTouchingParts()
			for _,v in pairs(hit) do
				if not touchedalready then
					touchedalready = true
					local human = v.Parent:FindFirstChild("Humanoid")
					human:TakeDamage(25)
					wait(0.5)
					touchedalready = false
					end
					end --for pairs
		end --if name
	end) -- anime playing
loader:Play()



    local equipsound1 = Instance.new("Sound", hum.Parent)
    local ssound1 = Instance.new("Sound", hum.Parent)
    local qeqsound1 = Instance.new("Sound", hum.Parent)
    local ssound2 = Instance.new("Sound", hum.Parent)
 
    equipsound1.SoundId = "rbxassetid://3688156764"
   ssound1.SoundId = "rbxassetid://220833967"
ssound2.SoundId = "rbxassetid://3052200129"
    qeqsound1.SoundId = "rbxassetid://2304904662"
idleloader:Play()
end)

Hope you can figure this out, For any deep questions, message me via discord: http_shawn#7389

Thank you!