Rotate a mesh thats using LookAt.

Soo, I have been working on this turret script. But my turret is facing the wrong way. I would rather rotate it with script then do it within maya. I have used many self-built codes but I just can’t do it.

any idea?

here is a video with my problems:
http://www.screencast.com/users/CreativeCoding/folders/Default/media/4c6cac2d-ddc8-4e98-b7b5-499042b2409a

(You need windows media plugin to view it)

Here is my code:

var target : Transform;
var lockY = true;
var editRotation = false;
var zRotation : float = 0;
var xRotation : float = 0;
var yRotation : float = 0;



@AddComponentMenu("Camera-Control/Smooth Look At")
partial class SmoothLookAt { }



function LateUpdate () {
	if (target) {
	

		if(lockY){
			transform.LookAt(Vector3(target.position.x, transform.position.y, target.position.z));
		}
		else
		{
			// Just lookat
		    transform.LookAt(target);
		}
		
		//Change rotation for object if its not facing the right way.
		if(editRotation == true){
			this.transform.rotation.z = target.position.z + zRotation;
			this.transform.rotation.x = target.position.x + xRotation;
			this.transform.rotation.y = target.position.y + yRotation;
		}
		
	}
}

function Start () {
	// Make the rigid body not change rotation
   	if (rigidbody)
		rigidbody.freezeRotation = false;
}

Come on? Is there at least any way I could make it face the right way?