Sword doesn't work when you click for a short amount of time

I made a Sword script and it does work, but only if you click long enough. if you click fast, it sometimes doesn’t damage the dummy. Can someone help me?
Here is the code

local Sword = script.Parent
local canDamage = true
local Debounce = 0.7
local isActivated = false

local function damage()
	Sword.Handle.Touched:Connect(function(hit)
		local hum = hit.Parent:FindFirstChild("Humanoid")
		if hum and canDamage then
			if isActivated then
				canDamage = false
				hum.Health = hum.Health - 10
				Sword.Deactivated:Connect(function()
					wait(Debounce)
					canDamage = true
				end)
			else return end	
		end
	end)
end

Sword.Activated:Connect(function()
	isActivated = true
	print("Activated_"..tostring(isActivated))
	Sword.Deactivated:Connect(function()
		isActivated = false
		print("Activated_"..tostring(isActivated))
	end)
end)

damage()

Here is a video of what I mean.
robloxapp-20200728-1243394_Trim.wmv (510.0 KB)

I think it is because you’re setting the isActivated and canDamage value in different .Deactivated events. isActivated will continuously be toggled as you are clicking fast, but the canDamage will have to wait a 0.7 second so just put those two things together. Beside, why do you need an isActivated? Isn’t canDamage enough?

canDamage was indeed enough. I don’t know why I put isActivated in the script. I was just trying some things out and I ended up with that. (I just started with scripting and I’m not very good) I removed the isActivated and it works fine, but now there are two problems. One is that the first attack can be performed without clicking and the second is that the damage is done after some time. Here’s a video of what I mean. (The first issue isn’t really a problem)
robloxapp-20200728-1511455_Trim.wmv (517.8 KB)

nevermind I got it. The script works good now.