Hi, I have a sword with two scripts, and the sword only deals damage on the first hit. It gives no errors, and I cant find out whats wrong with it.
1st script
script.Parent.Blade.Touched:connect(function(p)
if script.Parent.CanDamage.Value == true then
script.Parent.CanDamage.Value = false
if p.parent.Zombie then
p.Parent.Zombie:TakeDamage (script.Parent.Damage.Value)
end
else
end
end)
2nd Script
local CanAttack = true
script.Parent.Activated:connect(function()
local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Attack)
if CanAttack == true then
attack:Play()
CanAttack = false
wait(1)
attack:Stop()
CanAttack = true
script.Parent.CanDamage.Value = true
end
end)
I have everything inside the sword and it doesn't work, does anyone see any problems?

9 comments
And I know it's late, so I might not been on if someone answers.
script.Parent.CanDamage.Value = true; this line should be after CanAttack is set to false (or after the attack animation is played). Our goal here is to damage while the attacking animation is playing.
Don't ever worry about not being on when someone answers, we all understand we're probably in different timezones.
Also why do you have it in 2 different scripts if they are both children of the same object?
I changed it PhantomVisual, and nothing changed. And idk why I have 2 scripts.
Would it help if I combine them?
Also, I'm testing it more and CanDamage is always true.
output?
Nothings in the output