Freezeing x and z axis in LookAt?

Hi heveryone this is my first post! I’m new to unity and to javascript too, but willing to learn ^^

I’m making my first game which is a kind of 2d shooter.
I want my gun to follow the mouse pointer (The game view is from above) and I’ve tried a lot of scripts but everyone’ve had a mistake: the gun turns upward when you pass with the pointer on the character and so the spawnpoint of the shoots.
I’d need a rotation of the object just on the Y axis, looking at the mouse pointer: can someone help me?

You can use Quaternion.SetLookRotation() (via transform.rotation.SetLookRotation()), or calculate the rotation manually and zero the x/y components before applying it.