Running thing

I am making a game with a guy running, and when the key is let go he is still running or the animation is still going, how would i make it when the key is up he stops running?