So what I'm trying to do is make a camera rotate around a part while moving up and down the x axis. Problem is that since its locally rotating, it will be wonky and sometimes rotate upside down. How would I rotate the camera at a world/global axis? Also, here is my script.

local target = workspace.AnimationDummy.Head
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 0
local updown = 0
 
while wait() do
    camera.CoordinateFrame = CFrame.new(target.Position)  --Start at the position of the part
                           * CFrame.Angles(updown, angle, 0) --Rotate by the angle
                           * CFrame.new(0, 0, 20)       --Move the camera backwards 5 units
    angle = angle + math.rad(2)

  updown = updown + math.rad(1)
	if updown == 20
		then
		updown = updown - math.rad(1)
	elseif updown == -20 then
		updown = updown + math.rad(1)
	end
end