Rotating player's Camera

So I want to rotate a player’s camera based on them controlling how much to rotate on the x, y, and z axis. However, let’s say a player’s camera is at -15,0,0 (orientation) and they want to increment the y axis of the camera by 1 to be -15,1,0. This doesn’t do that, it increments y AND z by a small value.

My code is here: (essentially, it’s just a way for players to record scenes for their YouTube videos easier in Roblox studio)

Controls are this image:

local function updateCamera(posOrRot,axis,value)
	if posOrRot=="Position" then
		if axis == "X" then
			workspace.CurrentCamera.CFrame=CFrame.new(value,workspace.CurrentCamera.CFrame.Position.Y,workspace.CurrentCamera.CFrame.Position.Z)
			mainFrame.positionFrame.positionOptions.xPositionButtonController.Frame.TextBox.Text = math.round(value*1000)/1000
		elseif axis == "Y" then
			workspace.CurrentCamera.CFrame=CFrame.new(workspace.CurrentCamera.CFrame.Position.X,value,workspace.CurrentCamera.CFrame.Position.Z)
			mainFrame.positionFrame.positionOptions.yPositionButtonController.Frame.TextBox.Text = math.round(value*1000)/1000
		else
			workspace.CurrentCamera.CFrame=CFrame.new(workspace.CurrentCamera.CFrame.Position.X,workspace.CurrentCamera.CFrame.Position.Y,value)
			mainFrame.positionFrame.positionOptions.zPositionButtonController.Frame.TextBox.Text = math.round(value*1000)/1000
		end
		workspace.CurrentCamera.CFrame*=CFrame.fromOrientation(math.rad(allScenes[currentSelectedFilmId][currentSelectedScene]["Animations"][currentAnimationSelected]["Orientation"].X),math.rad(allScenes[currentSelectedFilmId][currentSelectedScene]["Animations"][currentAnimationSelected]["Orientation"].Y),math.rad(allScenes[currentSelectedFilmId][currentSelectedScene]["Animations"][currentAnimationSelected]["Orientation"].Z))
	elseif posOrRot == "Orientation" then
		local xOrientation,yOrientation,zOrientation = workspace.Camera.CFrame:ToEulerAnglesXYZ()
		local pos = workspace.CurrentCamera.CFrame.Position
		local rot = workspace.CurrentCamera.CFrame - pos
		if axis == "X" then
			--workspace.CurrentCamera.CFrame*=CFrame.fromOrientation(math.rad(value)-xOrientation,0,0)
			rot = CFrame.fromAxisAngle(Vector3.new(1,0,0),math.rad(value)-xOrientation) * rot
			workspace.CurrentCamera.CFrame = rot + pos
			mainFrame.orientationFrame.orientationOptions.xOrientationButtonController.Frame.TextBox.Text = math.round(value*1000)/1000	
		elseif axis == "Y" then
			--workspace.CurrentCamera.CFrame*=CFrame.fromOrientation(0,math.rad(value)-yOrientation,0)
			--workspace.CurrentCamera.CFrame*=CFrame.fromAxisAngle(Vector3.new(0,1,0),math.rad(value)-yOrientation)
			rot = CFrame.fromAxisAngle(Vector3.new(0,1,0),math.rad(value)-yOrientation) * rot
			workspace.CurrentCamera.CFrame = rot + pos
			mainFrame.orientationFrame.orientationOptions.yOrientationButtonController.Frame.TextBox.Text = math.round(value*1000)/1000	
		else
			workspace.CurrentCamera.CFrame*=CFrame.fromOrientation(0,0,math.rad(value)-zOrientation)
			mainFrame.orientationFrame.orientationOptions.zOrientationButtonController.Frame.TextBox.Text = math.round(value*1000)/1000	
		end
	else
		
	end
end

Any help helps! Thanks!

note:

math.rad(value)-(x,y, or z)Orientation is just how much camera is being rotated by on an axis. for instance, if it was equal to 1, that would just mean that player wants to increase/decrease an x, y, or z value of orientation by 1 radian. (player would obviously type degrees, but this is just for formality when doing the code)

ask any other questions on what something means, i’ll answer it for you

you need to rotate the Y value of the camera first (Yaw) then the X after (Pitch) so it rotates correctly :))

This was what ChatGPT outputted. It doesn’t work since it will just rotate on the tilted axis.

Seemingly the best solution is:

camera.CFrame = CFrame.new(camera new position) * CFrame.fromOrientation(the angle for x, y, and z, but in radians)