mecanim boolean not working

alright so, m working on a parkour game and this seems to have come up … the parkour script works and lets my character jump over, but does not let it go back to its previous state,
the boolean “canleap” turns true, but never turns false… i just cant figure out the problem :confused:

( m new to the forums and unity, so forgive me if m doing something wrong)

heres the script -

internal var animator: Animator;

var legs : GameObject;
var range : float;

function Start () {
    animator = GetComponent("Animator");
}

function FixedUpdate() {
   
     jumpover();

                     
        }
        
        
        function jumpover (){
 var hit : RaycastHit;
 var direction = legs.transform.forward ;
    
        
  if(Physics.Raycast(transform.position,direction,hit,range)) {
     if(hit.collider.gameObject.tag == "box") {
       Debug.Log("it hits ");
      
            //if(Input.GetKey(KeyCode.E)) {

                animator.SetBool("canleap",true);
      }
    
             else  animator.SetBool("canleap",false);
    
}
}

first off try to keep your variables all at the begining of the code so its nice and tidy, and speaking of tidy your spacing was great until you got to line 15 then idk what happened haha. try taking out the else, because once the animator starts the animation i don’t think it keeps checking if its still true. also in your current setup the boolean will only return to false if you don’t see another box within range which is a little sketchy, no offense. give it a try without the else and see if that doesn’t fix things? :smiley: