controller.move only moves on z axis, no jump or strafe

I have been working on building a basic 3D platform game in the same vein as Mario64. I started out using simpleMove but wanted something a little bit more flexible. Despite the fact that I obtained the controller.Move script from the Unity documentation, it only moves my character forward and backwards. The strafe and jump code seem to do nothing. Here is the code as I have it:

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

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.GetKeyDown("space"))
		{
			moveDirection.y = jumpSpeed;
		}
	}
	
	//Apply gravity
	moveDirection.y -= gravity * Time.deltaTime;
	
	//Move the controller
	controller.Move(moveDirection * Time.deltaTime);
}

Have I missed something? There is no transform target and my character has a character controller attached. I’m sorry if this has already been brought up, but after a few days of cruising the forum I can’t find an answer. Thanks.

This should be

 if (Input.GetKeyDown("space"))

        {

            moveDirection.y += jumpSpeed;

        }

that should solve your jump problem…

I don’t see any reason if the player moves forward backward why the up and down movements aren’t working

Thank you kingcharizard. I will give this a try and see what happens.