Well, for this one, there are two separate scripts that play the walking animation (there are a few scripts that use multiple characters)
I also usually set the animation to play when the character does something, not when the keyboard is pressed.
In this case, I make the player play the walk animation whenever the keys are pressed.