Allow Camera to face straight up or down

Alright! I am making a spaceship which uses BodyGyro and BodyVelocity to move around. Everything has been working fine, but the ship cannot go straight up or straight down (because of the camera) , preventing the ship from going in loops.

I am quite sure this is an issue with the camera. I have it set to Scriptable and offset behind the player.
The line below creates an offset for the camera, and sets the camera to that CFrame every frame.

camera.CFrame = player.Character:GetPivot() * CFrame.new(0, 7, 35)

I have searched on the dev forums for answers. I found one which worked on its own, but I couldn’t find a way to make it compatible with my ship.

Thanks in advance!