My Character keeps moving?

Ok, so here’s my problem.
I have searched for a long time (I usually never come and ask on forum but after weeks i do it.)

Ok so I have a Character (which i imported from cinema 4d) I want to animate him so I did it. I also made him move around but here’s the thing. He moves too much. Even if i release the key he still go forward which isn’t supposed to happen. So i post my code hoping for a solution.

//Variable public
var speed : float = 6.0;
var jumpSpeed : float = 8.0;
var gravity : float = 20.0;

	//Variables privees
	private var moveDirection : Vector3 = Vector3.zero;
	function Stop (){
		
	}
	function Update() {
		deltaTime = Time.deltaTime;
		var controller : CharacterController = GetComponent(CharacterController);
		
		if (controller.isGrounded) {
		
			if(Input.GetKey(KeyCode.W)){
				  moveDirection = Vector3(Input.GetAxis("Horizontal"),0,Input.GetAxis("Vertical"));
			 		animation.CrossFade("walk"); 
						moveDirection = transform.TransformDirection(moveDirection); 
							moveDirection *= speed * deltaTime;  
			} 
			if(Input.GetKey(KeyCode.S)){
				  moveDirection = Vector3(Input.GetAxis("Horizontal"),0,Input.GetAxis("Vertical"));
			 		animation.CrossFade("walk"); 
						moveDirection = transform.TransformDirection(moveDirection); 
							moveDirection *= speed * deltaTime;  
			}
			if(Input.GetKey(KeyCode.A)){
				  moveDirection = Vector3(Input.GetAxis("Horizontal"),0,Input.GetAxis("Vertical"));
			 		animation.CrossFade("walk"); 
						moveDirection = transform.TransformDirection(moveDirection); 
							moveDirection *= speed * deltaTime;  
			} 
			if(Input.GetKey(KeyCode.D)){
				  moveDirection = Vector3(Input.GetAxis("Horizontal"),0,Input.GetAxis("Vertical"));
			 		animation.CrossFade("walk"); 
						moveDirection = transform.TransformDirection(moveDirection); 
							moveDirection *= speed * deltaTime;  
			}
			if (Input.GetButton ("Jump")) {
				moveDirection.y = jumpSpeed;
			} 
			else if (!Input.anyKey){
				animation.CrossFade("idle");
				}
				
		}  

	
		moveDirection.y -= gravity * deltaTime;
		
	
		controller.Move(moveDirection * deltaTime);
	}

He plays the animations just fine. The thing is that i want him to stop moving when im not actually moving.
Any suggestions?

Make sure moveDirection is in fact vector.zero when you aren’t moving. Try Debug.log to see what the values are for MoveDirection.

Disable ApplyRootMotion in the Animator Controller

Click Checkbox Inspector > Animation > Animations > Play Automaticly