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

How do I make an animation stop for a few seconds then play again?

Asked by 3 years ago

Hello. For a while now I've been trying to get this really simple script to work, but it never does.

Basically, what it SHOULD do is; -load animation -play animation -wait for animation to stop -wait for a certain amount of time -play animation again -wait for it to stop again -wait the seconds again

However, it doesn't stop, just continuously loops the animation over and over again, doesn't stop, and doesn't wait with no errors in output. The code is;

01local animation = script:WaitForChild('Animation')
02local humanoid = script.Parent:WaitForChild('Humanoid')
03local dance = humanoid:LoadAnimation(animation)
04dance.Looped = false
05 
06while true do
07    dance:Play() --i want it to play animation
08    dance.Stopped:Wait() --wait until the animation is stopped
09    dance:Stop() --stops animation
10    wait(5) --and i wanted it to wait a certain amount of time until it plays the animation again
11end
12wait(0.5)

Does anyone know why my script isn't working? It should simply play animation, wait for it to stop, wait for 5 seconds, then replay anim, wait for stop, wait 5 seconds, and repeats the process. Thank you.

1 answer

Log in to vote
0
Answered by 3 years ago

Nvm, my animation was exported as looped apparently.

Ad

Answer this question