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

Issue With Animation (Plays Twice Quickly?)

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

✓ Accepted answer

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.

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

The length is at the top of the plugin frame.

  1. 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

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