Camera CFrame sets incorrectly when using Viewport frame

  1. What do you want to achieve? I want to make something like webcam, that will have a display (Viewport frame) that will show whats in front of the part (webcam). I update camera’s cframe each frame with the cframe of part

  2. What is the issue? The camera is rotating only by X axis or something

  3. What solutions have you tried so far? I tried to manualy set the cframe for camera, but it seems to ignore some rotation

Camera is being created with local scripts, as well as part

here is code being used to update camera

local VFrame = script.Parent

local GUI = VFrame.Parent
local CAM = Instance.new("Camera",GUI)
VFrame.CurrentCamera = CAM
CAM.CameraType = Enum.CameraType.Scriptable


local pl = game.Players.LocalPlayer

while GUI.Adornee == nil do
	task.wait()
	GUI.Adornee = workspace:WaitForChild("RightHand["..pl.Name.."]").HandDevice.Part
end
game["Run Service"].RenderStepped:Connect(function()
	if GUI.Adornee then
		CAM.CFrame = GUI.Adornee:GetPivot()*CFrame.Angles(0,math.rad(180),0)
		--print(GUI.Adornee:GetFullName())
	end
end)

Game is being played in VR, maybe cuz of VR mode smth is wrong