I’ve had reports starting from a few hours ago of weapons and other tools in my game seemingly no longer functioning as intended despite no update to the game at that time.
Upon further investigation, this appears to be related to a recent Roblox FFlag change, FixKeyframeDetection
, that was also enabled around the same time I started receiving reports in.
The error I’m getting is this:
11:01:03.477 - Maximum event re-entrancy depth exceeded for AnimationTrack.KeyframeReached
11:01:03.478 - While entering function defined in script 'Players.KarlXYZ.PlayerScripts.LocalScript', line 17
Looking into the code running in the live game, it appears to be caused by immediately calling :Stop()
on an animation track after receiving a .KeyframeReached
event of the final keyframe in the animation of an AnimationTrack
. Calling :Stop()
in this manner causes the same .KeyframeReached
event to be fired again, thus causing the :Stop()
being called again and so on for about 6 times until we reach the maximum re-entrancy depth.
This was not the original behaviour of .KeyframeReached
which would not fire .KeyframeReached
again following any :Stop()
call, thus avoiding any recursion in this case.
I’ve made an un-copylocked repro place here that highlights the issue when looking at the client output around 3 seconds after spawning in. The code is in a LocalScript
in StarterPlayerScripts
.
I’m aware that keyframe naming in animations appear to be deprecated in favour of the new animation markers, however, due to the naming of the suspect FFlag it appears this behavior was unintentional as part of some other fix.