Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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)
0
There's no implementation of any animation in your script. Le_Teapots 913 — 6y
0
I know, that's just the *damage* script not the animation script. Would you like me to add my animation script? HypedNebula 28 — 6y

1 answer

Log in to vote
0
Answered by
Fifkee 2017 Community Moderator Moderation Voter
6 years ago

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)
0
Thank you. It worked. HypedNebula 28 — 6y
Ad

Answer this question