Walking whilde Crouching?

Hello

so I’ve been trying to make the crouch system in my game. Everything was going fine until i found out i wasn’t able to make my character walk while crouching. I have the “walk while crouching” animation aswell as the “crouch idle” animation. I can crouch and stand up but when it comes to walk while crouching, my character just hoovers around in “crouch idle” animation. How can i make it so that when i press “w,s,a,d” while pressing down “c” to crouch, plays the crouch walking animation? I’m using .js, this is my script (i’m new to all this):

#pragma strict

var anim: Animation;

function Start(){
	GetComponent.<Animation>()["_arm|Crouching_bone"].layer = 1;
	GetComponent.<Animation>()["_arm|CrouchWalk_bone"].layer = 1;
}

function Update(){
	if(Input.GetKeyDown("c")){
		GetComponent.<Animation>().Play("_arm|Crouching_bone");
	}
	else
	
	if(Input.GetKeyUp("c")){
		GetComponent.<Animation>().Stop("_arm|Crouching_bone");
	}
	
	if(Input.GetKeyDown("c")){
		if(Input.GetKeyDown("w")){
			GetComponent.<Animation>().Play("_arm|CrouchWalk_bbone");
		}
		else
		
		if(Input.GetKeyUp("w")){
			GetComponent.<Animation>().Stop("_arm|CrouchWalk_bbone");
		}
	}
}

First of all, go learn some general info about coding.

Second, use Input.GetKey() when dealing with animations and controls.

Third, use character states and never “stop” animations for characters because there should be a new animation each time the player is pressing or not pressing something.

References: