Need Help with Animation/Script Timing

I have recently made an ability for a game I’m creating, and I’m having some issues with timing the animation that the player does and the script for the visuals of the ability. I took two videos of what it’s supposed to look like and what it looks like most of the time.!!

The script uses a bunch of waits for when to rotate the cross and when to spawn the particles, which is probably the issue, but it’s the only way I know.

I would also love if someone could tell me how to improve the vfx!

Realized I uploaded the same video, this is one of the bad examples:

Instead of relying on wait() or task.wait() for animation timing, you can use GetMarkerReachedSignal() from the Animator.

This allows you to fire the code when a KeyframeMarker is reached during an animation. To use it, you’ll need to add and name a marker in your animation using the Animation Editor.

This is way better than using waits, because it doesn’t depend on the frame rate or client performance meaning the timing will always match up exactly with the animation, regardless of FPS.

1 Like

You could try using animation markers/events. You should be able to find them with whatever tool you are using to animate in roblox with.

This is mainly done with this code.

track:GetMarkerReachedSignal()

All it does is find where a specific named marker is, and what time in the animation it’s used in.

Heres a document on how it works if you would like a more indepth explanation.

1 Like

Thank you both, this is exactly what I needed!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.