Sword hit problem

I have a big problem with programming the sword. The point is, it hits a few times but the damage deal is set to 5. Look

dev.wmv (1.1 MB)

you can see that it deals damage multiple times. Here are my scripts.

forum1

This “CoolDown” is Bool value

forum2

this is animation script. ^

forum3

and this is damage script ^

can it be solved. I would be very grateful

Damage script needs a debounce check:

local debounce = false
script.Parent.Touched:Connect(function(hit))
      local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid")
      if humanoid and not debounce then
          humanoid:TakeDamage(5)
          debounce = true
          wait(1)
          debounce = false
      end
end)
1 Like

yes it works thanks a lot!!!

1 Like