Changing camera settings disrupts scripted camera behavior

I made a script that will set the players camera to a part in an object value:

while true do
wait()

if script.Parent.Goal.Value then
local plr = game.Players.LocalPlayer
local cam = workspace.CurrentCamera

cam.CameraType = "Scriptable"
cam.CameraSubject = script.Parent.Goal.Value
cam.CFrame = script.Parent.Goal.Value.CFrame

end

end

if I went to the menu and changed the camera setting, this will disrupt the camera and will make it appear to “bug out”:

robloxapp-20200709-1352394.wmv (1.3 MB)

in the video after the camera is changed, I was attempting to pan the camera which lead to the camera spasming.

any way to prevent this behavior from occuring? the camera should always be fixed to its goal.

cam.CameraType = Enum.CameraType.Scriptable

To revert it back to the user selected camera mode:

cam.CameraType = Enum.CameraType.Custom

I found the solution, I had to change a setting in starterplayer called
“DevComputerCameraMovementMode”, by changing it to classic that prevented players from changing their camera settings and breaking the game.