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

Damage script only works when animation plays but doesn't?

Asked by 5 years ago

I'm trying to make the hands do damage to the npc but it doesn't work. I tried out different methods like a Punching script tutorial but the scripts are too messed up

local LoadAnimation = Char.Humanoid:LoadAnimation(game.ReplicatedStorage.Animation1)
  script.Parent.RightHand.Touched:connect(function(hit)
   if hit.Parent.Humanoid and LoadAnimation.IsPlaying == true then
    hit.Parent.Humanoid:TakeDamage(2)
   end
  end)

  script.Parent.LeftHand.Touched:connect(function(hit)
   if hit.Parent.Humanoid and LoadAnimation.IsPlaying == true then
    hit.Parent.Humanoid:TakeDamage(2)
   end
  end)

Am I doing this correctly? or should I change the LoadAnimation.IsPlaying to debounce?

0
I think you should do it another way. Try making a script inside the players torso that reacts when it's touched. Make the 2 parts in different scripts. 1 script for animation and 1 script for damage. TheLightningRises 56 — 5y
0
Do I use a local script?How do I make the script go inside the player's torso?? rochel89 42 — 5y
0
Wait I think i got it rochel89 42 — 5y
0
nevermind,I don't understand what you mean :/ rochel89 42 — 5y
View all comments (2 more)
0
You should play animations on the client and damage on the server User#19524 175 — 5y
0
ok rochel89 42 — 5y

1 answer

Log in to vote
-2
Answered by 5 years ago

(Best Answer) Find out for me: one difference and, one similarity between Global, and Local scripts. Thank you.

Ad

Answer this question