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

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

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

Nvm, my animation was exported as looped apparently.

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