Is there any way I could pause/resume an animation?

My animation is ending a bit earlier than I would like, and if there’s a method out there to pause it and resume it that would be phenomenal. Thanks!

I think that setting its speed to 0 would work

2 Likes

Definitely will try it. Thank you. :slight_smile:

It may still be the case the actual zero still stops the track completely, firing the ending event and all that, but something like 0.00001 could be used to effectively stop it without actually canceling it. If zero doesn’t work, maybe try not-quite-zero.

2 Likes

Would using

local speed = (1/math.huge)

Work? Or does it just round downwards?

I’m pretty sure that division by math.huge (inf) is special-cased (defined) to evaluate to true 0.

Have you considered dividing animation into pieces?

In the first paragraph of the AdjustSpeed method’s description, it specifically says that setting the speed to (true) 0 pauses the animation.

3 Likes

Pausing and resuming is quite easy there is a special colon operated function for that. One is anim:Resume(). And the other one is anim:Pause().

  • anim:Pause() pauses the animation
  • anim:Resume() Resumes the animation

anim:Pause()
wait(3)
anim:Resume()

3 Likes

I don’t think it will pause as 1/any number > 0 so theoretically it shouldn’t work.