I make characters throw a punch upon pressing E, and shove if they hold it down for .3s.
This means the shove has to override the punch.
To make it clean I decided I should make an animsArray for all active animations in effect on the Humanoid in my combat system here. That way I can simply iterate through it and stop then destroy any currently playing animations before playing the shove one - in this instance stopping the punch anim before playing shove. I do this by adding the animationTrack itself of the animation to my animsArray.
The thing is animationTrack doesn’t have an ended event, and I know very little about how animations work and little is said about how they work. I would expect to remove an animationTrack from the array when it finishes but there is no ended event to connect to. How can I accomplish making it so that animsArray only holds the punch animation for the duration it is running and active? Are animationTracks garbage collected as soon as they stop playing, or being referenced, or what? There is little info on this and I am quite lost.