How to fix this jumping in this script?

var jump = 0;
var jumped =10f;
var moe = 10f;

function Update () 
{
var cc : CharacterController = GetComponent(CharacterController );


var forward = Input.GetAxis("Vertical") * moe;
var side = Input.GetAxis("Horizontal") * moe;

jump +=Physics.gravity.y * Time.deltaTime;

if(Input.GetButtonDown("Jump") && cc.isGrounded)
	{
		jump = jumped;
	}

var movement = Vector3 (side,jump,forward);
cc.Move (movement * Time.deltaTime);
}

When i jump,the character stays in the air. How to correct this problem?

var jump: float = 0;
var jumped : float=10f;
var moe = 10f;

function Update () 
{
var cc : CharacterController = GetComponent(CharacterController );
 
 
var forward = Input.GetAxis("Vertical") * moe;
var side = Input.GetAxis("Horizontal") * moe;
 
jump +=Physics.gravity.y * Time.deltaTime;
 
if(Input.GetButtonDown("Jump") && cc.isGrounded)
    {
       jump = jumped;
    }
 
var movement = Vector3 (side,jump,forward);
cc.Move (movement * Time.deltaTime);
}

i finally figured it out. I had to make both the jump and jumped variables floats

The problem is how you declared ‘jump’. You used:

var jump = 0;

This makes jump an integer. So you were truncating floating point values to the an integer and therefore ‘jump’ was remaining 0. The fix:

var jump : float = 0;

or

var jump = 0.0;

Or you can combine the two.