Disable player turning based on camera CFrame

I am trying to make it so that the player dosn’t turn whenever the camera switch views I believe this is happening because the player is in first person and the characters root part cframe matches the camera cframe. And I can’t just anchor the player because I need the player to be able to move.

https://gyazo.com/996aa7df093e3ff7bd7ae106815d5af7

local UserInputService = game:GetService("UserInputService")
local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local char = player.Character
local RunService = game:GetService("RunService")
local mouse = player:GetMouse()

local CT = false
local Before = nil
local num = 1

camera.FieldOfView = 100
player.Character.Humanoid.CameraOffset = Vector3.new(0, -0.5, -1.5)

local foes = game.Workspace.Foes

UserInputService.MouseIconEnabled = false

function header()
	local tab = foes:GetChildren()
	print(tab[num])
	head = tab[num].Head
end

RunService.Heartbeat:Connect(function(step)
	if CT == true then
		camera.CFrame = head.CFrame
	end
end)

UserInputService.InputEnded:Connect(function(input, processed)
	if  processed then return end
	if input.UserInputType == Enum.UserInputType.MouseButton3 then
		if CT == false then
			Before = camera.CFrame
			head = game.Workspace.Foes.Dummy.Head
			camera.CameraType = Enum.CameraType.Scriptable
			for childIndex, child in pairs(player.Character:GetChildren()) do
			    if child:IsA("BasePart") then     
			        child.LocalTransparencyModifier = child.Transparency
				   end
				if child:IsA("Accessory") then
					child.Handle.LocalTransparencyModifier = child.Handle.Transparency
				end  
			end
			CT = true
			wait()
		else
			CT = false
			camera.CameraType = Enum.CameraType.Follow
			camera.CameraSubject = player.Character
			camera.CFrame = Before
		end
	end
end)

mouse.WheelForward:Connect(function()
	if CT == true then
		if num == #foes:GetChildren() then
			num = 1
		else
			num = num + 1
		end
		header()
	end
end)

mouse.WheelBackward:Connect(function()
	if CT == true then
		if num == 1 then
			num = #foes:GetChildren()
		else
			num = num - 1
		end
		header()
	end
end)

Never mind i’ll just change the camera mode to third person or something