I have a script where you play an animation track, it waits the tracks length then does something. However, when you first join the track plays and the length is literally 0, so it’s instant. It looks chopped, does anyone know how to fix this? I’m playing the track on the server because it needs to be on the server.
EDIT: So I also checked out preloadasync, and I made a script that preloads it on the client. This doesn’t change how it works on the server, AND the animation tends to fail preloading for some reason it never succeeds to preload.
If you are playing the animation track, there is an event called .Stopped, which, you can use the method :Wait() on to wait until the animation track has stopped, which should wait until the animation track has stopped playing, exactly the length. Although, I’m not really sure if it has any delay, there’s probably a catch
Disregard the things above. If you’re trying to sync with keyframes or a certain time in an animation, you should do like what xKaihatsu said, or perhaps do things the OG way - KeyframeReached
You can still use GetMarkerReached just by adding GetMarkerReached:Wait(). What this does is wait until the marker is reached but just making it wait until the event is fired instead of creating a whole function.
Try using AnimationTrack.Stopped. It fires once the anim is over (which i’m guessing is what you’re going for), so you won’t have to do wait(AnimationTrack.Length).