Making a Jetpack

I am trying to make is so that my player has like a jet boost to push him up in the air when you press the Left Shift key.

I have tried all the following codes for no results.

This One

if ( Input.GetKey("v") )
 constantForce.force = 8000 * Vector3.up;
else 
 constantForce.force = Vector3.zero;

This One:

var boostFactor : float = 100; // or whatever
 
function Update () {
 
if ( Input.GetKey("left shift") ) {
 target.rigidbody.velocity += target.transform.up * boostFactor;
}

This One:

if ( jetpackOn ) 
 localGravity += jetpackAcceleration * Time.deltaTIme;
else
  localGravity -= 9.81 * Time.deltaTime;
 
charactercontroller.Move( Vector3( x, localGravity, z ) );

None of these even make my character leave the ground. I have just the starndard character controller on it using the thirdperson controller and i have added a ridgidbody.

Use this code Instead

var speed : float = 6.0;
var jumpSpeed : float = 8.0;
var gravity : float = 20.0;

private var moveDirection : Vector3 = Vector3.zero;

function Update() {
    var controller : CharacterController = GetComponent(CharacterController);
    if (controller.isGrounded) {
        // We are grounded, so recalculate
        // move direction directly from axes
        moveDirection = Vector3(Input.GetAxis("Horizontal"), 0,
                                Input.GetAxis("Vertical"));
        moveDirection = transform.TransformDirection(moveDirection);
        moveDirection *= speed;
        
        if (Input.GetButton (KeyCode.V)) {
            moveDirection.y = jumpSpeed;
        }
    }

    // Apply gravity
    moveDirection.y -= gravity * Time.deltaTime;
    
    // Move the controller
    controller.Move(moveDirection * Time.deltaTime);
}

Does your character have a rigidbody attached? you can’t add forces to an object unless said object has a rigidbody attached. And IF it does have a rigid body attached make sure isKinimatic is unchecked. After all that try using rigidbody.addforce.

ok here. look using the character controller. u may use a very useful script from the documentation.

movement script

here u can find how to “Jump” but u can modify it to ur convenience. give it a try.