Character won't jump script help.

I have followed a tutorial to the letter and while my character moves in a 2d planes like I want it doesn’t seem to jump. I have the script here but can’t figure out what went wrong.

Jump Script

#pragma strict

var dt : double;

var jumpButton: String;
var jumpDelay : float;
var jumpForce : double;

var canJump: boolean;
var timeSinceLastJump: float;

var base : GroundDetection;
var movement : LateralMovement;

function Start () {

dt = Time.deltaTime;

jumpButton = "Jump";
jumpForce = 6;
jumpDelay = 2.5;

canJump = false;
timeSinceLastJump = 10;

base = gameObject.GetComponentInChildren(GroundDetection);
movement = gameObject.GetComponent(LateralMovement);

}

function Update () {

timeSinceLastJump += dt;

if(base.onGround){

movement.SetSuspension(false);

if(timeSinceLastJump > jumpDelay){

canJump = true;

}

else if (!AirControl()){

movement.SetSuspension(true);

if(canJump && Input.GetButton(jumpButton)){

rigidbody.velocity.y += jumpForce;

canJump = false;
timeSinceLastJump = 0;

}

}

}

}

function AirControl(){

return rigidbody.velocity.y > 0;

}

Your problem is line 45 else if (!AirControl()){

If you are able to jump timeSinceLastJump > jumpDelay will return true, and so the else will never be called.

Getting rid of the else should solve your problem!