Still have questions? Join our Discord server and get real time help.
0

# I need help with my sword, it's dealing damage the first hit then stops. Can anyone help fix it?

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()

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?

0
And I know it's late, so I might not been on if someone answers. protectiverobos -50 — 3mo
0
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. PhantomVisual 664 — 3mo
0
Don't ever worry about not being on when someone answers, we all understand we're probably in different timezones. SteamG0D 579 — 3mo
0
Also why do you have it in 2 different scripts if they are both children of the same object? SteamG0D 579 — 3mo