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

Issue With Animation (Plays Twice Quickly?)

Asked by 4 years ago

Basically, I have a problem with the animation. Here's the code:

while part.parent.Humanoid.health >= 1 do

        pew:Play()

        part.parent.Humanoid.Health = part.parent.Humanoid.Health -5

        wait(pew.Length)
        wait(.1)





    end

The animation plays, but what happens is the gun goes in a burst, and the code does too. So the health goes down 5 twice in this burst.

Everything else in the code works fine, it's just the animation and humanoid help. Here's a short video of what happens: https://gyazo.com/1d65b907a1023bcdefac8315d7535a78

1 answer

Log in to vote
0
Answered by 4 years ago

Animations don't have length in their properties, so you need to do it manually. You can find the length in Animation Editor. Here are 3 steps to find animation length and put it into your script:


1. Import your animation into Animation Editor

You can import Animation Editor Animations by clicking the 3 dots, then clicking Import, and clicking "From Roblox" or "From FBX Animation"

There you can see all of the stats of the animation.

2. You can see the length somewhere in the plugin frame

The length is at the top of the plugin frame.

3. Insert animation

I will give you some edits for your script:

while part.parent.Humanoid.health >= 1 do

        pew:Play()

        part.parent.Humanoid.Health = part.parent.Humanoid.Health -5

        wait(animLength) -- animation length
        wait(.1)
end

b_mni

Ad

Answer this question