Degree rotation relative to part

Let say for example the camera is facing the same direction as another part, then the camera rotates 90 degrees, how do i get that rotation relative to the first parts orientation.

the code I wrote kinda works but prints very small numbers instead of degrees:

``````local relativeCF = Camera.CFrame:ToObjectSpace(CamPart.CFrame)
local rotation = relativeCF - relativeCF.Position
local x, y, z = rotation:ToEulerAnglesYXZ()
print(Vector3.new(x,y,z))
``````

You can use the dot product for this:

``````local angle = math.acos(part.CFrame.LookVector:Dot(camera.CFrame.LookVector))
``````

The result is in radians, if needed you can convert it to degrees by calling math.deg. This will give you the shortest angle between the two vectors with respect to their shared plane.

okay so basicly, it’s in radient(I’m not too sure what that is either) to convert it to degrees, use `math.deg()` also `:ToEulerAnglesYXZ()` returns y, x, z not x, y, z use `:ToEulerAnglesXYZ()` instead