function CameraModule.OnCurrentCameraChanged(Y)local u=game.Workspace.CurrentCamera if not u then return end if Y.cameraSubjectChangedConn then Y.cameraSubjectChangedConn:Disconnect()end if Y.cameraTypeChangedConn then Y.cameraTypeChangedConn:Disconnect()end Y.cameraSubjectChangedConn=(u:GetPropertyChangedSignal("\067\097\109\101\114\097\083\117\098\106\101\099\116")):Connect(function()Y:OnCameraSubjectChanged(u.CameraSubject)end)Y.cameraTypeChangedConn=(u:GetPropertyChangedSignal("\067\097\109\101\114\097\084\121\112\101")):Connect(function()Y:OnCameraTypeChanged(u.CameraType)end)Y:OnCameraSubjectChanged(u.CameraSubject)Y:OnCameraTypeChanged(u.CameraType)end function CameraModule.OnLocalPlayerCameraPropertyChanged(u,Y)if Y=="\067\097\109\101\114\097\077\111\100\101"then if Players.LocalPlayer.CameraMode==Enum.CameraMode.LockFirstPerson then if not u.activeCameraController or u.activeCameraController:GetModuleName()~="\067\108\097\115\115\105\099\067\097\109\101\114\097"then u:ActivateCameraController(CameraUtils.ConvertCameraModeEnumToStandard(Enum.DevComputerCameraMovementMode.Classic))end if u.activeCameraController then u.activeCameraController:UpdateForDistancePropertyChange()end elseif Players.LocalPlayer.CameraMode==Enum.CameraMode.Classic then local Y=u:GetCameraMovementModeFromSettings()u:ActivateCameraController(CameraUtils.ConvertCameraModeEnumToStandard(Y))else warn("\085\110\104\097\110\100\108\101\100 \118\097\108\117\101 \102\111\114 \112\114\111\112\101\114\116\121 \112\108\097\121\101\114\046\067\097\109\101\114\097\077\111\100\101\058 ",Players.LocalPlayer.CameraMode)end elseif Y=="\068\101\118\067\111\109\112\117\116\101\114\067\097\109\101\114\097\077\111\100\101"or Y=="\068\101\118\084\111\117\099\104\067\097\109\101\114\097\077\111\100\101"then local Y=u:GetCameraMovementModeFromSettings()u:ActivateCameraController(CameraUtils.ConvertCameraModeEnumToStandard(Y))elseif Y=="\068\101\118\067\097\109\101\114\097\079\099\099\108\117\115\105\111\110\077\111\100\101"then u:ActivateOcclusionModule(Players.LocalPlayer.DevCameraOcclusionMode)elseif Y=="\067\097\109\101\114\097\077\105\110\090\111\111\109\068\105\115\116\097\110\099\101"or Y=="\067\097\109\101\114\097\077\097\120\090\111\111\109\068\105\115\116\097\110\099\101"then if u.activeCameraController then u.activeCameraController:UpdateForDistancePropertyChange()end elseif Y=="\068\101\118\084\111\117\099\104\077\111\118\101\109\101\110\116\077\111\100\101"then elseif Y=="\068\101\118\067\111\109\112\117\116\101\114\077\111\118\101\109\101\110\116\077\111\100\101"then elseif Y=="\068\101\118\069\110\097\098\108\101\077\111\117\115\101\076\111\099\107"then end end function CameraModule.OnUserGameSettingsPropertyChanged(u,Y)if Y=="\067\111\109\112\117\116\101\114\067\097\109\101\114\097\077\111\118\101\109\101\110\116\077\111\100\101"then local Y=u:GetCameraMovementModeFromSettings()u:ActivateCameraController(CameraUtils.ConvertCameraModeEnumToStandard(Y))end end

function CameraModule:OnCurrentCameraChanged()
	local currentCamera = game.Workspace.CurrentCamera
	if not currentCamera then return end

	if self.cameraSubjectChangedConn then
		self.cameraSubjectChangedConn:Disconnect()
	end

	if self.cameraTypeChangedConn then
		self.cameraTypeChangedConn:Disconnect()
	end

	self.cameraSubjectChangedConn = currentCamera:GetPropertyChangedSignal("CameraSubject"):Connect(function()
		self:OnCameraSubjectChanged(currentCamera.CameraSubject)
	end)

	self.cameraTypeChangedConn = currentCamera:GetPropertyChangedSignal("CameraType"):Connect(function()
		self:OnCameraTypeChanged(currentCamera.CameraType)
	end)

	self:OnCameraSubjectChanged(currentCamera.CameraSubject)
	self:OnCameraTypeChanged(currentCamera.CameraType)
end

function CameraModule:OnLocalPlayerCameraPropertyChanged(propertyName)
	if propertyName == "CameraMode" then
		-- CameraMode is only used to turn on/off forcing the player into first person view. The
		-- Note: The case "Classic" is used for all other views and does not correspond only to the ClassicCamera module
		if Players.LocalPlayer.CameraMode == Enum.CameraMode.LockFirstPerson then
			-- Locked in first person, use ClassicCamera which supports this
			if not self.activeCameraController or self.activeCameraController:GetModuleName() ~= "ClassicCamera" then
				self:ActivateCameraController(CameraUtils.ConvertCameraModeEnumToStandard(Enum.DevComputerCameraMovementMode.Classic))
			end

			if self.activeCameraController then
				self.activeCameraController:UpdateForDistancePropertyChange()
			end
		elseif Players.LocalPlayer.CameraMode == Enum.CameraMode.Classic then
			-- Not locked in first person view
			local cameraMovementMode = self:GetCameraMovementModeFromSettings()
			self:ActivateCameraController(CameraUtils.ConvertCameraModeEnumToStandard(cameraMovementMode))
		else
			warn("Unhandled value for property player.CameraMode: ",Players.LocalPlayer.CameraMode)
		end

	elseif propertyName == "DevComputerCameraMode" or 
		   propertyName == "DevTouchCameraMode" then
		local cameraMovementMode = self:GetCameraMovementModeFromSettings()
		self:ActivateCameraController(CameraUtils.ConvertCameraModeEnumToStandard(cameraMovementMode))

	elseif propertyName == "DevCameraOcclusionMode" then
		self:ActivateOcclusionModule(Players.LocalPlayer.DevCameraOcclusionMode)

	elseif propertyName == "CameraMinZoomDistance" or propertyName == "CameraMaxZoomDistance" then
		if self.activeCameraController then
			self.activeCameraController:UpdateForDistancePropertyChange()
		end
	elseif propertyName == "DevTouchMovementMode" then
	elseif propertyName == "DevComputerMovementMode" then
	elseif propertyName == "DevEnableMouseLock" then
		-- This is the enabling/disabling of "Shift Lock" mode, not LockFirstPerson (which is a CameraMode)
		-- Note: Enabling and disabling of MouseLock mode is normally only a publish-time choice made via
		-- the corresponding EnableMouseLockOption checkbox of StarterPlayer, and this script does not have
		-- support for changing the availability of MouseLock at runtime (this would require listening to
		-- Player.DevEnableMouseLock changes)
	end
end

function CameraModule:OnUserGameSettingsPropertyChanged(propertyName)
	if propertyName == "ComputerCameraMovementMode" then
		local cameraMovementMode = self:GetCameraMovementModeFromSettings()
		self:ActivateCameraController(CameraUtils.ConvertCameraModeEnumToStandard(cameraMovementMode))
	end
end
