Touched event only works once

Im having issues with values, tools and parts

  1. What I want to achieve
    When the tool hits the part the health will go down

  2. The issue
    When I hit it once with the tool’s blade, the part looses an health point, but if I do it another time, it does not work.

  3. What I tried
    I’ve looked on the devforum but wasn’t able to find any solutions.

Heres the script inside the part

script.Parent.Touched:Connect(function(hit)
	if hit.Name == 'Blade' then --The blade is inside a tool
		script.Parent.Parent.Health.Value -= 1 --Health
		if script.Parent.Parent.Health.Value <= 0 then
			--My stuff
		end
	end
end)

Video example :

The output does not show any errors.

Edit : Heres the scripts in the blade

script.Parent.Touched:Connect(function(hit)
	script.Parent.Hit.Playing = true
	script.Parent.CanTouch = false
end)

And in the tool

script.Parent.Activated:Connect(function()
	if script.Parent.CanActivate.Value == true then
		script.Parent.CanActivate.Value = false
		script.Parent.Swing.Playing = true
		wait(0.1)
		script.Parent.Blade.CanTouch = true
		wait(0.75)
		script.Parent.Blade.CanTouch = false
		wait(0.5)
		script.Parent.CanActivate.Value = true
	end
end)

Thanks!

How is this scripted? Is this activated on click?

The tool is activated on click to play the animation and get the CanTouch properity on true, but I believe that this is not the problem as the sounds that plays when the tool hits the tree is in the tool script.

could I acces your place to check?

if theres more than 1 child in your tool, try this script (reposting this because it didn’t send on the first time)

script.Parent.Touched:Connect(function(hit)
	if hit.parent.Name == 'Blade' then --The blade is inside a tool
		script.Parent.Parent.Health.Value -= 1 --Health
		if script.Parent.Parent.Health.Value <= 0 then
			--My stuff
		end
	end
end)```

This is because you are checking if the health is <= to 0, which I believe is not what you intend. it should be >= if I understand your situation correctly.

The ‘’<= 0’’ is perfectly fine, my issue is that when the part in my tool touches the other part wich is in workspace, it only works once, but not twice as it is intended to.

If I remember correctly the Touched event only fires if 2 parts in the same collision group that have CanTouch set to true touch so I think your problem is that the way your blade and tool scripts are configured, there’s a chance that the blade’s CanTouch is set to false when the blade touches the tree. I suggest leaving CanTouch set to true for the blade and removing the blade’s Touched event while also removing the lines inside the Tool’s script that disables the blade’s CanTouch property because you don’t need to keep turning it off or on