Scripting "If only" functions?

The title may be confusing but it’s not wrong. I wrote a script to deal with animations for sprinting in my game. So A is walk, D is walk, Shift+A is run, Shift+D is run. The problem is unity sees Shift+A as Shift and A, so it does the walk function rather than the run function. I got to this point but couldn’t actually solve the problem :smiley: typical noob. Heres the script you can see what im talking about`
var animator : Animator;

function Update(){
	if(Input.GetKey(KeyCode.A) && Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.D) && Input.GetKey(KeyCode.LeftShift)){
		animator.SetBool("Running", true);
		}else{
		animator.SetBool("Running", false);
	}
	if(Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.D)){
		animator.SetBool("Walking", true);
		}else{
		animator.SetBool("Walking", false);
	}
}

Simple solution. Line 7 should employ the not operator !

if(Input.GetKey(KeyCode.A) && !Input.GetKey(KeyCode.LeftShift)){
// You can do the same thing with an or for the D key

You could also use a nested if to achieve the same function.

if(Input.GetKey(KeyCode.A)){
    if(Input.GetKey(KeyCode.LeftShift)){
        //Do stuff that needs both buttons pushed
    } else {
        //Do stuff that only relys on A
    }
}

how about try select case?

switch(Input.GetKey)  

{  

case KeyCode.LeftShift:  

if(Input.GetKey(KeyCode.A)||Input.GetKey(KeyCode.D))  

//run animation script  

case default:  

//walk animation script  

}