Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a sword damage script that ONLY activates when the animation is activated?

Normally, when a sword isn't playing an animation, it deals damage. How would I make it only deal damage when the sword animation is activated?

Current Damage Script:

script.Parent.blade.Touched:connect(function(p)
  if script.Parent.CanDamage.Value == true then
      script.Parent.CanDamage.Value = false
      p.Parent.Humanoid:TakeDamage(20)
  end
end)

2 comments

0

There's no implementation of any animation in your script.

0

I know, that's just the damage script not the animation script. Would you like me to add my animation script?

1 answer

✓ Accepted answer

IsPlaying is a thing.

script.Parent.blade.Touched:connect(function(p)
  if script.Parent.CanDamage.Value == true and script.Animation.IsPlaying then
      script.Parent.CanDamage.Value = false
      p.Parent.Humanoid:TakeDamage(20)
  end
end)

1 comment

0

Thank you. It worked.

This discussion is preserved as it was. New answers, comments, and votes are closed.