Can I avoid a gimbal lock with custom camera?

Hi, I’m making a custom camera. But I ran into a gimbal lock when the y angle hits 90. after that I can’t move the x angle. Is there a way to avoid this without learning quaternions?

local NewCFrame = Camera.CameraSubject.CFrame * CFrame.Angles(math.rad(CameraY),math.rad(CameraX),0) * CFrame.new(0,0,ScrollDistance)
NewCFrame = CFrame.lookAt(NewCFrame.Position, Camera.CameraSubject.Position)