do local n=PlayersService.LocalPlayer:WaitForChild("\080\108\097\121\101\114\083\099\114\105\112\116\115")local I=pcall(function()n:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Default)end)if I then n:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Follow)n:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Classic)n:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Default)n:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Follow)n:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Classic)end end local n={[Enum.CameraType.Attach]=AttachCamera;[Enum.CameraType.Fixed]=FixedCamera,[Enum.CameraType.Scriptable]=ScriptableCamera,[Enum.CameraType.Track]=TrackCamera,[Enum.CameraType.Watch]=WatchCamera,[Enum.CameraType.Follow]=FollowCamera}if isOrbitalCameraEnabled then n[Enum.CameraType.Orbital]=OrbitalCamera end local I=nil local X=nil local r=nil local t=nil local u=nil local B=nil local m=false local function W()return UserInputService.TouchEnabled end local function H()local n=PlayersService.LocalPlayer local I=workspace.CurrentCamera if AllCamerasInLua then return true else if n then if I==nil or I.CameraType==Enum.CameraType.Custom or isOrbitalCameraEnabled and I.CameraType==Enum.CameraType.Orbital then return true end end end return false end local function q()local n=H()local I=PlayersService.LocalPlayer if n and I then if m and B==Enum.UserInputType.Touch or W()then if I.DevTouchMovementMode==Enum.DevTouchMovementMode.ClickToMove or I.DevTouchMovementMode==Enum.DevTouchMovementMode.UserChoice and GameSettings.TouchMovementMode==Enum.TouchMovementMode.ClickToMove then return true end else if I.DevComputerMovementMode==Enum.DevComputerMovementMode.ClickToMove or I.DevComputerMovementMode==Enum.DevComputerMovementMode.UserChoice and GameSettings.ComputerMovementMode==Enum.ComputerMovementMode.ClickToMove then return true end end end return false end local function c()local n=H()local I=PlayersService.LocalPlayer if n and I then if m and B==Enum.UserInputType.Touch or W()then if not FFlagUserNoCameraClickToMove and q()then return Enum.DevTouchMovementMode.ClickToMove.Name elseif I.DevTouchCameraMode==Enum.DevTouchCameraMovementMode.UserChoice then local n=GameSettings.TouchCameraMovementMode if n==Enum.TouchCameraMovementMode.Default then return Enum.TouchCameraMovementMode.Follow.Name end return n.Name else return I.DevTouchCameraMode.Name end else if not FFlagUserNoCameraClickToMove and q()then return Enum.DevComputerMovementMode.ClickToMove.Name elseif I.DevComputerCameraMode==Enum.DevComputerCameraMovementMode.UserChoice then local n=GameSettings.ComputerCameraMovementMode if n==Enum.ComputerCameraMovementMode.Default then return Enum.ComputerCameraMovementMode.Classic.Name end return n.Name else return I.DevComputerCameraMode.Name end end end end local function P()local n=H()local I=PlayersService.LocalPlayer if n and I then return I.DevCameraOcclusionMode end end
-- register what camera scripts we are using
do
	local PlayerScripts = PlayersService.LocalPlayer:WaitForChild("PlayerScripts")
	local canRegisterCameras = pcall(function()
		PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Default)
	end)

	if canRegisterCameras then
		PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Follow)
		PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Classic)

		PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Default)
		PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Follow)
		PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Classic)
	end
end

local CameraTypeEnumMap = {
	[Enum.CameraType.Attach] = AttachCamera,
	[Enum.CameraType.Fixed] = FixedCamera,
	[Enum.CameraType.Scriptable] = ScriptableCamera,
	[Enum.CameraType.Track] = TrackCamera,
	[Enum.CameraType.Watch] = WatchCamera,
	[Enum.CameraType.Follow] = FollowCamera,
}

if isOrbitalCameraEnabled then
	CameraTypeEnumMap[Enum.CameraType.Orbital] = OrbitalCamera
end

local EnabledCamera = nil
local EnabledOcclusion = nil

local cameraSubjectChangedConn = nil
local cameraTypeChangedConn = nil
local renderSteppedConn = nil

local lastInputType = nil
local hasLastInput = false

local function IsTouch()
	return UserInputService.TouchEnabled
end

local function shouldUsePlayerScriptsCamera()
	local player = PlayersService.LocalPlayer
	local currentCamera = workspace.CurrentCamera
	if AllCamerasInLua then
		return true
	else
		if player then
			if
				currentCamera == nil
				or (currentCamera.CameraType == Enum.CameraType.Custom)
				or (isOrbitalCameraEnabled and currentCamera.CameraType == Enum.CameraType.Orbital)
			then
				return true
			end
		end
	end
	return false
end

local function isClickToMoveOn()
	local usePlayerScripts = shouldUsePlayerScriptsCamera()
	local player = PlayersService.LocalPlayer
	if usePlayerScripts and player then
		if (hasLastInput and lastInputType == Enum.UserInputType.Touch) or IsTouch() then -- Touch
			if
				player.DevTouchMovementMode == Enum.DevTouchMovementMode.ClickToMove
				or (
					player.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice
					and GameSettings.TouchMovementMode == Enum.TouchMovementMode.ClickToMove
				)
			then
				return true
			end
		else -- Computer
			if
				player.DevComputerMovementMode == Enum.DevComputerMovementMode.ClickToMove
				or (
					player.DevComputerMovementMode == Enum.DevComputerMovementMode.UserChoice
					and GameSettings.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove
				)
			then
				return true
			end
		end
	end
	return false
end

local function getCurrentCameraMode()
	local usePlayerScripts = shouldUsePlayerScriptsCamera()
	local player = PlayersService.LocalPlayer
	if usePlayerScripts and player then
		if (hasLastInput and lastInputType == Enum.UserInputType.Touch) or IsTouch() then -- Touch (iPad, etc...)
			if not FFlagUserNoCameraClickToMove and isClickToMoveOn() then
				return Enum.DevTouchMovementMode.ClickToMove.Name
			elseif player.DevTouchCameraMode == Enum.DevTouchCameraMovementMode.UserChoice then
				local touchMovementMode = GameSettings.TouchCameraMovementMode
				if touchMovementMode == Enum.TouchCameraMovementMode.Default then
					return Enum.TouchCameraMovementMode.Follow.Name
				end
				return touchMovementMode.Name
			else
				return player.DevTouchCameraMode.Name
			end
		else -- Computer
			if not FFlagUserNoCameraClickToMove and isClickToMoveOn() then
				return Enum.DevComputerMovementMode.ClickToMove.Name
			elseif player.DevComputerCameraMode == Enum.DevComputerCameraMovementMode.UserChoice then
				local computerMovementMode = GameSettings.ComputerCameraMovementMode
				if computerMovementMode == Enum.ComputerCameraMovementMode.Default then
					return Enum.ComputerCameraMovementMode.Classic.Name
				end
				return computerMovementMode.Name
			else
				return player.DevComputerCameraMode.Name
			end
		end
	end
end

local function getCameraOcclusionMode()
	local usePlayerScripts = shouldUsePlayerScriptsCamera()
	local player = PlayersService.LocalPlayer
	if usePlayerScripts and player then
		return player.DevCameraOcclusionMode
	end
end
