How can I fix this NPC's animations

So I have an idle animation for my npc but when he does an action, I make the idle animation stop and the action animation play. This works, but the npc goes into a stiff position before playing the action animation.
robloxapp-20211008-1403404.wmv (419.0 KB)
Is there a method I could use to make this look smoother? Here’s the code if you need it.

local AttackAnim = humanoid:LoadAnimation(attack_anim)
local length = AttackAnim.Length
AttackAnim.Looped = false
								
StopAnimationTrack(humanoid)
AttackAnim:Play()

wait(length)

Any help is appreciated! Thank you

Can anyone help me with this ?

I think it looks fine as is animation wise. The particles show up too early and makes it look like the NPC is shooting while the gun is pointed down, which looks weird to me. If you really don’t like the small stiff pose between the animations, you could make an in-between animation.

Thank you for pointing this out. I am aware of this an I’m planning on changing it later.