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 2 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;

local animation = script:WaitForChild('Animation')
local humanoid = script.Parent:WaitForChild('Humanoid')
local dance = humanoid:LoadAnimation(animation)
dance.Looped = false

while true do
    dance:Play() --i want it to play animation
    dance.Stopped:Wait() --wait until the animation is stopped
    dance:Stop() --stops animation
    wait(5) --and i wanted it to wait a certain amount of time until it plays the animation again
end
wait(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 2 years ago

Nvm, my animation was exported as looped apparently.

Ad

Answer this question