Changing walking speed in CharacterController.Move

I have a script:

private var moveDirection : Vector3 = Vector3.zero;

var speed = 3;

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

    Screen.showCursor = false;
		
		moveDirection = Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
		moveDirection = transform.TransformDirection(moveDirection);
		moveDirection *= speed;
		
		controller.Move (moveDirection * Time.deltaTime);
		
		transform.Rotate(Vector3(0, Input.GetAxis("Mouse X"), 0) * Time.deltaTime * 50);
		 
		if (Input.GetKeyDown (KeyCode.LeftShift))
		{
			speed += 10;
		}
		
		if (Input.GetKeyUp (KeyCode.LeftShift))
		{
			speed -= 10;
		}
}

How can I change the movement speed when I press W, A, S and D (It works for sprint but not if I do it for the other keys)

Backwards will be when ‘Input.GetAxis(“Vertical”)’ is negative. So you can add between lines 11 and 12:

if (moveDirection.z < 0.0) {
    moveDirection.z *= someFactor;
}

Where ‘someFactor’ will have a value between 0.0 and 1.0 for a slow down.