Help setting maximum velocity

I have been trying but for some reason nothing works when i try and set a maxSpeed for my spaceship. could some help me please?

var forwardThumbPad : GUITexture;

private var thisTransform : Transform;

var forwardSpeed : float = 200;
var vectorForceX : Vector3;
var accelRatio : float = .1;

var maxShipSpeed : float;
@HideInInspector

function Start () {

	thisTransform = GetComponent(Transform);
}

function Update () {

	if(Input.touches.Length <= 0)
	{
	
	}
	else
	{
	
		for(var i = 0; i < Input.touchCount; i++)
		{
		
			if(this.forwardThumbPad.HitTest(Input.GetTouch(i).position))
			{
				
				if(Input.GetTouch(i).phase == TouchPhase.Stationary)
				   {
				   var movement = thisTransform.TransformDirection(Vector3.zero);
				   movement.z += forwardSpeed;
					
				   var force = vectorForceX * movement.z;
				   rigidbody.AddForce(force);
				  
				
				}
				if(Input.GetTouch(i).phase == TouchPhase.Ended)
				{

				
				}
			}
		}
	}

}

There are a couple of things you can do. First you can just stop adding force if the velocity is at or over your threshold. So line 38 becomes:

if (rigidbody.velocity.magnitude < maxShipSpeed)
    rigidbody.AddForce(force);

Another way is to limit the velocity directly. At like 40, put:

if (rigidbody.velocity.magnitude > maxShipSpeed) 
    rigidbody.velocity = rigidbody.velocity.normalized * maxShipSpeed;