Gun point at 2d MousePosition. Restrict rotation?

I’m using a script to aim the gun of my UFO to the mouse position. It should aim at the mouse x and y. The z position should be at 0. The problem is that when the mouse is above or under the gun it starts to rotate. How do I restrict this rotation?
I have tried adding a rigidbody and then restricted. All the scripts seem to do this that i searched for.

1282806--58023--$help00001.jpg

here’s my code:

function Update () {
	var mousePos = Input.mousePosition;
    	var worldPos = Camera.mainCamera.ScreenToWorldPoint(mousePos);
     	worldPos.z=0;
    	transform.LookAt(worldPos);
}

You’ll need to do two things.

First, provide an “up” direction to LookAt, so that it knows which direction the 3rd axis of the transform has to point in.

Second, check the distance of the target point before doing the LookAt, to make sure that they’re not the same or too close, because things can’t look towards each other if they’re in the same spot.

thanx! got it right