My camera is supposed to move on the X and Y axis, but it also moves on the Z axis

My camera movement script takes input from X and Y mouse movement, and is only supposed to move on the X and Y axis, but it also moves on the Z axis. What can I do?,My camera movement script is supposed to move only on the X and Y axis, but it moves on the Z axis too. How can I fix this?

Here is my code:

void FixedUpdate{

    if (Input.GetAxis("Mouse X")<0)
    {
        transform.Rotate(0, -3.5f, 0);
    }
    if (Input.GetAxis("Mouse X")>0)
    {
        transform.Rotate(0, 3.5f, 0);
    }
    if (Input.GetAxis("Mouse Y") < 0)
    {
        transform.Rotate(-1f, 0, 0);
    }
    if (Input.GetAxis("Mouse Y") > 0)
    {
        transform.Rotate(1f, 0, 0);
    }},

void FixedUpdate{

if (Input.GetAxis(“Mouse X”)<0)
{
transform.Rotate(0, -3.5f, 0);
}
if (Input.GetAxis(“Mouse X”)>0)
{
transform.Rotate(0, 3.5f, 0);
}
if (Input.GetAxis(“Mouse Y”) < 0)
{
transform.Rotate(-1f, 0, 0);
}
if (Input.GetAxis(“Mouse Y”) > 0)
{
transform.Rotate(1f, 0, 0);
}
}

@Hi JosephCedenoK, There is not enough information to tell where the problem might be. Have you parented the camera to another object? The default frame of reference for transform.Rotate is with respect to the local axes orientations. If you have parented the object you are rotating to another object then the rotations may not appear to be the same as what you have applied.

@JosephCedenoK hey would you be able to create a screen capture and share a visual of whats happening? As @streeetwalker said the code provided doesn’t have any reference to z rotation and so what you are describing shouldn’t be happening.