Turret rotation problem

I`m trying to make a turret controlled by mouse coordinates and have run into a few issues.

Although it works fine, the turret itself is not rotating with the parent but stays perfectly horizontal like a gyroscope…

Although I`m a noob, I do understand why this is happening, but is there a workaround to fix the problem?

var zDistance = 10.0;
var turret01 : Transform;
var turret02 : Transform;
var Turret : AudioClip;
   
 
	function Start () {    
}
   	function Update () {
    
       turretz();
       turretx();    
       }

	function turretz(){	
	
		var mousePos = Input.mousePosition;
		turret01.LookAt(Camera.main.ScreenToWorldPoint(Vector3(mousePos.x, mousePos.y, zDistance)));

 		    }

	function turretx(){	
	
		var mousePos = Input.mousePosition;
		turret02.LookAt(Camera.main.ScreenToWorldPoint(Vector3(mousePos.x, mousePos.y, zDistance)));
		
		transform.eulerAngles.x=0;
		
 
}

My first thought is that you’re referencing the actual turret in your script. I’m assuming from you question that you already have your turret in a container in Unity. Just make sure the turret is a child of the container then the two transforms you have in this script should reference the container, not the turret and it should work.

-Kaze-