Keep Camera.CFrame.Rotation when switching Camera.Subject?!

For some reason in my game when I do Camera.CameraSubject, the Camera.CFrame.Rotation changes to a seemingly random CFrame instead of staying at Camera.CFrame.

I’ve spent a lot of time trying to figure out the cause but could not reproduce the problem in a test world. I used the same model and same everything.

Does anyone know why when changing Camera.CameraSubject it changes the rotation? I want that when switching Camera.CameraSubject it keeps Camera.CFrame.Rotation so that the camera doesn’t “jump”.

local camera = workspace.CurrentCamera
local x, y, z = camera.CFrame:ToOrientation()
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = workspace.Part --example
camera.CFrame *= CFrame.fromOrientation(x, y, z)

Finally found the source of the problem!

The one thing I didn’t try in a test world is setting player.Character = character and that’s the one thing that’s causing the issue!!!

Very annoying when backend Roblox code completely messes you up and you have no idea why.