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

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

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?

6 comments

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.

0

Do I use a local script?How do I make the script go inside the player's torso??

0

Wait I think i got it

0

nevermind,I don't understand what you mean :/

0

You should play animations on the client and damage on the server

0

ok

1 answer

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

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