Getting an Object's Orientation and Converting It for math.rad

  1. What do you want to achieve?

I want to get the camera’s orientation and converting it for math.rad for so i can assign it again using CFrame.Angles(math.rad())

  1. What is the issue?

So i dont know how am i going to get the current orientation of the camera, and how am i going to convert it so it can be assigned as math.rad

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I did try looking up for ways but i cant/dont understand a thing, since im new around CFrames.

runServ.RenderStepped:Connect(function()
				task.wait()
				if canRender == false and state == true then
					if justOpened then
						justOpened = false
						camera.CFrame = CFrame.new((humanoidRootPart.CFrame.Position + humanoidRootPart.CFrame.LookVector * 30), humanoidRootPart.CFrame.Position + Vector3.new(0, .5, 0))
						-- Im trying to get the orientation from here
					else
						if cameraPos ~= nil then
							local startCFrame = CFrame.new(humanoidRootPart.CFrame.Position + Vector3.new(0, 0, 0)) * CFrame.Angles(0, math.rad(xAngle), 0)
                           -- And assign it here as the "xAngle" variable which is using math.rad

							local cameraCFrame = startCFrame + startCFrame:vectorToWorldSpace(Vector3.new(cameraPos.X, cameraPos.Y, cameraPos.Z))
							
							camera.CFrame = CFrame.new(cameraCFrame.Position, humanoidRootPart.CFrame.Position + Vector3.new(0, .5, 0))
							
						end
					end
				end
			end)

Thanks in advance!

Get Orientation in radians using
game.Workspace.CurrentCamera.CFrame:ToOrientation()
This article may help you: