Keyframe Marker events delayed sometimes?

In my game, I use keyframe markers to do things like add trails to weapons. Currently, it works flawlessly 90% of the time. I preload the animations on the client when a player joins, I play the animation on the server through an animator object, then I use the keyframe marker reached event to determine when to enable the weapon’s trail. Works like a charm. Sometimes, however, it’ll just decide not to be this consistent upon joining a new server. Even after playing the animation multiple times, the marker reached event will always fire late to the point where the trail will be enabled after the weapon has already swung. Am I doing something wrong? Confused on how to fix this.

1 Like

this could probably be an issue with latency, if the trails are turned on via the keyframe events on the server it might be latency making the changes get replicated to your screen late.

So is that just a server thing? I’ve noticed that happening even in servers where my ping is low.

Then I dont know, do you have a lot of events? and how are they made, maybe you have a memory leak and you are leaving these events connected even when they are not needed anymore.

This is a problem I notice happening immediately upon joining a new server, so I don’t think there’s enough time for memory leaks to build up to make this happen. Some servers just kinda have delayed marker events. They animations themselves play at the right time and there’s no noticeable desync between when I press a button to fire a remote and when the server receives it to play the animation. It’s just the markers deciding to be a little late.

If you are 100% sure your code is right and you are not doing anything wrong or you arent using a lot of events or server resources you should report this to roblox as a bug. I advice you to look at your code extra carefully before reporting the bug because most of the time its actually the developer doing something wrong anf they realise last second.

I’m not really sure what I could do wrong to cause this. Server resource thing doesn’t make sense considering it happens immediately in new servers but only occasionally as mentioned above