Returning player to an idle animation when anchoring player

I’m anchoring a player’s humanoid root part.
The problem? If they’re moving while they are anchored, the walk animation continues.
How do I stop this? And return it to their idle animation, or a neutral state?

I also want them to go back to normal after I unanchor them, so they can still move and walk animation plays when it should all that (like I said, normal).
Also, if there happens to be a better idea than anchoring the player, do tell, and explain