Hi, I have a sword that works perfectly fine, except it only deals damage on the first hit then stops. I get no errors and I dont know whats wrong with it. Here are the 2 scripts that I have in my sword.

1st script (normal 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 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)

8 comments

7

holy jesus the indentation and deprecated functions, you clearly took this from a free model

0

Yes, also that is against the rules, I've also seen this spaghetti code somewhere.

0

this is a piece of art

0

Because you never tried. If you gave at least some effort into making your own, then we'd help, if not, then feel free to keep using free models.

0

I did, I tested a lot of stuff in it and cant find the problem.

0

If I did, I wouldnt be asking.

0

-50 rep lol

0

no need to downvote or circle jerk so much guys lol you could always try to help you know