mouse x not working when mouse y in use?

so i have this script for mouse to move the model
and the mouse x dose not work with this script:

{
        // Rotation

        rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivity;
        transform.Rotate(0, rotLeftRight, 0);

       verticalRotation -= Input.GetAxis("Mouse Y") * mouseSensitivity;
       transform.localRotation = Quaternion.Euler(0, 0, verticalRotation);
    }

but… if i // out the mouse y lines:

{
        // Rotation

        rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivity;
        transform.Rotate(0, rotLeftRight, 0);

     //   verticalRotation -= Input.GetAxis("Mouse Y") * mouseSensitivity;
      //  transform.localRotation = Quaternion.Euler(0, 0, verticalRotation);
    }

the mouse x works
so ya please help me (I have no idea what i am doing LOL)

Because you are setting the rotation back to 0 with

transform.localRotation = Quaternion.Euler(0, 0, verticalRotation);

try this (pseudocode):

xRotation = Input.GetAxis("Mouse X") * sensitivity
yRotation = Input.GetAxis("Mouse Y") * sensitivity

transform.Rotate(yRotation, xRotation, 0)