I've already asked this question before, and I couldn't seem to find any help either. There doesn't seem to be any solutions to this problem anywhere, so I came back to see if I could get some help. Basically what's going on is that I made a script that changes a player's camera angle (or mode) depending on the Mode. If the mode is Top then the camera is positioned above the player, however, if it is set to FirstP, then the player is set to first person. However, after being in first person, the character starts to move in a weird way, not being able to rotate around, just stuck facing one position. Does anyone know how I can fix it?

Top view: https://i.gyazo.com/340727e0e8ea52369848252b65b14acf.gif

First person: https://i.gyazo.com/8320be3ae548065eec533f96fffdf2ef.gif

Top view with issue: https://i.gyazo.com/c0c5f7ef790680c0dae380aeb3eef517.gif

Code:

-------------------------------------------------------------------------Locals
local RunSer = game:GetService("RunService")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Cam = workspace.CurrentCamera
local RootP = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")
local Mode = script.Parent.Mode
local Cam_Height = script.Parent.Cam_Height
local Cam_Rotation = script.Parent.Cam_Rotation
local Cam_FarX = script.Parent.Cam_FarX
local Cam_FarZ = script.Parent.Cam_FarZ --These are just values for the player's camera angle and such
local Cam_RotationZ = script.Parent.Cam_RotationZ
local Cam_RotationY = script.Parent.Cam_RotationY
-------------------------------------------------------------------------Default
Cam.CameraType =Enum.CameraType.Scriptable
-------------------------------------------------------------------------RunServ
RunSer.RenderStepped:Connect(function()
	if Mode.Value == "Top" then
	Cam.CameraType = Enum.CameraType.Scriptable
	Cam.CameraSubject = Character
	game:GetService("TweenService"):Create(Cam,TweenInfo.new(.2,Enum.EasingStyle.Linear),{CFrame = CFrame.new(RootP.Position) * CFrame.fromEulerAnglesXYZ(-Cam_Rotation.Value,Cam_RotationY.Value,Cam_RotationZ.Value)+ Vector3.new(Cam_FarX.Value,Cam_Height.Value,Cam_FarZ.Value)}):Play()
	elseif Mode.Value == "FirstP" then
		local CT = tick()
		Cam.CameraType = Enum.CameraType.Custom
		Player.CameraMode = Enum.CameraMode.LockFirstPerson
		if Humanoid.MoveDirection.Magnitude > 0 then
			local X = math.cos(CT * 10) * .25 ---All this is just for the view bobbing effect
			local Y = math.abs(math.sin(CT * 10)) * .25
			Humanoid.CameraOffset = Humanoid.CameraOffset:lerp(Vector3.new(X,Y,0), .25)
		else
				Humanoid.CameraOffset = Humanoid.CameraOffset * .75
		end
		elseif Mode.Value == "None" then --This isn't connected to the issue
	end
end)