Hey developers. I’m trying to loop a animation at 2 points of the middle of the animation, in a local script. For example: animation gets to 2.3 seconds, and it loops it back down to 0.6 seconds, and repeats this. This is what I have so far:
repeat
talking:Play()
repeat task.wait() until talking.TimePosition >= EndTalkLoop --Works fine
talking.TimePosition = StartTalkLoop --Doesn't start it at here
until false
My issue is that the animation doesn’t start at the time I want it too (StartTalkLoop), but rather starts from 0. Is there any way I can fix it so it starts at 0.6 or any other time?
Much like Sound:Play(), AnimationTrack:Play() will set the time position, when called, to 0. You need to set the time position after calling AnimationTrack:Play().
First, you play the track (this sets TimePosition to 0). Then, you wait until the track is positioned after the “EndTalkLoop”. Next, you move the time position over to the start. Finally, you repeat this.
“You move the time position over to the start.” → “you play the track (this sets TimePosition to 0)”