Gun is tilted

So, I have a player which contains a Camera Holder. The Camera Holder is only rotated around the local x Axis. In the Camera Holder I have a Gun holder wich is rotated around the local X and Y Axis. I don’t touch the Z Axis at all but if I scope in my gun is tilted to the side. Anyone know why that is?

if (scoping)
{
    if (Vector3.Distance (transform.localPosition, scope.GetScopedPosition ()) < 0.05f)
    {
        transform.localPosition = scope.GetScopedPosition ();
        transform.localRotation = Quaternion.Euler (-holderRotation);

        if (scope.HasDepthOfField ())
        {
            depthOfField.active = true;
        }

        scoped = true;
    }
    else
    {
        transform.localPosition = Vector3.Lerp (transform.localPosition, scope.GetScopedPosition (), scope.GetScopeSpeed () / 100);
        transform.localRotation = Quaternion.Lerp (transform.localRotation, Quaternion.Euler (-holderRotation.x, -holderRotation.y, -holderRotation.z), scope.GetScopeSpeed () / 100);
    }
}
else
{
    if (Vector3.Distance (transform.localPosition, Vector3.zero) < 0.05f)
    {
        transform.localPosition = Vector3.zero;
        transform.localRotation = Quaternion.identity;
    }
    else
    {
        transform.localPosition = Vector3.Lerp (transform.localPosition, new Vector3 (0, 0, 0), scope.GetScopeSpeed () / 100);
        transform.localRotation = Quaternion.Lerp (transform.localRotation, Quaternion.identity, scope.GetScopeSpeed () / 100);
    }
    
    depthOfField.active = false;
    scoped = false;
}


Have you tried Quaternion.Slerp instead of Lerp?

Just did, but the lerping shouldn’t be the problem because I set the position as an absolute when I get close enough to the intended position.

I fixed it by using a Empty Game Object with the desired position and lerping to that