Dynamic Animation Update

so i have swords in my game and whenever i equip a sword, just like in gpo, idle anim plays, and theres also walking etc, everything works fine, but then theres the sprinting, now heres an example of how the sprint code in my game is:

local RunAnim = 'someidhere';

	if key == w then runanim:play end

now i want each time the player equips a tool that has a new run anim, to update the current running animation to the new running animation, now i tried doing it by using animator.animationplayed but it didnt work, does anybody know how to do this,

if you need more explanation tell me

Note: i want it to update instantly without having the player stop sprinting and sprint again to update current animations

There is a Classic Sword in the toolbox made by Roblox that has a bunch of animations.

It might help.

Just play the new animation, after that stop the old animation, it shouldn’t have any delay at all.

Edit: try to use Animator:GetPlayingAnimationTracks()

yes but i dont want to have like 10 loadanimations and like 100 lines of checks, isnt there a way to change an animationtrack animationid after it was loaded


It returns an array of animation tracks, just stop all animation except the new animation.