GameSettings.Changed:connect(function(m)if m=="\067\111\110\116\114\111\108\077\111\100\101"then if GameSettings.ControlMode==Enum.ControlMode.MouseLockSwitch then enableShiftLock()else disableShiftLock()end elseif m=="\067\111\109\112\117\116\101\114\077\111\118\101\109\101\110\116\077\111\100\101"then if GameSettings.ComputerMovementMode==Enum.ComputerMovementMode.ClickToMove then disableShiftLock()else enableShiftLock()end end end)LocalPlayer.Changed:connect(function(m)if m=="\068\101\118\069\110\097\098\108\101\077\111\117\115\101\076\111\099\107"then if LocalPlayer.DevEnableMouseLock then enableShiftLock()else disableShiftLock()end elseif m=="\068\101\118\067\111\109\112\117\116\101\114\077\111\118\101\109\101\110\116\077\111\100\101"then if LocalPlayer.DevComputerMovementMode==Enum.DevComputerMovementMode.ClickToMove or LocalPlayer.DevComputerMovementMode==Enum.DevComputerMovementMode.Scriptable then disableShiftLock()else enableShiftLock()end end end)LocalPlayer.CharacterAdded:connect(function(m)if not UserInputService.TouchEnabled then initialize()end end)
-- NOTE: This will fire for ControlMode when the settings menu is closed. If ControlMode is
-- MouseLockSwitch on settings close, it will change the mode to Classic, then to ShiftLockSwitch.
-- This is a silly hack, but needed to raise an event when the settings menu closes.
GameSettings.Changed:connect(function(property)
	if property == "ControlMode" then
		if GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch then
			enableShiftLock()
		else
			disableShiftLock()
		end
	elseif property == "ComputerMovementMode" then
		if GameSettings.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove then
			disableShiftLock()
		else
			enableShiftLock()
		end
	end
end)

LocalPlayer.Changed:connect(function(property)
	if property == "DevEnableMouseLock" then
		if LocalPlayer.DevEnableMouseLock then
			enableShiftLock()
		else
			disableShiftLock()
		end
	elseif property == "DevComputerMovementMode" then
		if
			LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.ClickToMove
			or LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.Scriptable
		then
			--
			disableShiftLock()
		else
			enableShiftLock()
		end
	end
end)

LocalPlayer.CharacterAdded:connect(function(character)
	-- we need to recreate guis on character load
	if not UserInputService.TouchEnabled then
		initialize()
	end
end)
