function ControlModule.OnComputerMovementModeChange(m)local O,n=m:SelectComputerMovementModule()if n then m:SwitchToController(O)end end function ControlModule.OnTouchMovementModeChange(m)local O,n=m:SelectTouchModule()if n then while not m.touchControlFrame do wait()end m:SwitchToController(O)end end function ControlModule.CreateTouchGuiContainer(m)if m.touchGui then m.touchGui:Destroy()end m.touchGui=Instance.new("\083\099\114\101\101\110\071\117\105")m.touchGui.Name="\084\111\117\099\104\071\117\105"m.touchGui.ResetOnSpawn=false m.touchGui.ZIndexBehavior=Enum.ZIndexBehavior.Sibling m.touchGui.Enabled=m.humanoid~=nil m.touchControlFrame=Instance.new("\070\114\097\109\101")m.touchControlFrame.Name="\084\111\117\099\104\067\111\110\116\114\111\108\070\114\097\109\101"m.touchControlFrame.Size=UDim2.new(1,0,1,0)m.touchControlFrame.BackgroundTransparency=1 m.touchControlFrame.Parent=m.touchGui m.touchGui.Parent=m.playerGui end function ControlModule.GetClickToMoveController(m)if not m.controllers[ClickToMove]then m.controllers[ClickToMove]=ClickToMove.new(CONTROL_ACTION_PRIORITY)end return m.controllers[ClickToMove]end return ControlModule.new()

function ControlModule:OnComputerMovementModeChange()
	local controlModule, success =  self:SelectComputerMovementModule()
	if success then
		self:SwitchToController(controlModule)
	end
end

function ControlModule:OnTouchMovementModeChange()
	local touchModule, success = self:SelectTouchModule()
	if success then
		while not self.touchControlFrame do
			wait()
		end
		self:SwitchToController(touchModule)
	end
end

function ControlModule:CreateTouchGuiContainer()
	if self.touchGui then self.touchGui:Destroy() end

	-- Container for all touch device guis
	self.touchGui = Instance.new("ScreenGui")
	self.touchGui.Name = "TouchGui"
	self.touchGui.ResetOnSpawn = false
	self.touchGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
	self.touchGui.Enabled = self.humanoid ~= nil

	self.touchControlFrame = Instance.new("Frame")
	self.touchControlFrame.Name = "TouchControlFrame"
	self.touchControlFrame.Size = UDim2.new(1, 0, 1, 0)
	self.touchControlFrame.BackgroundTransparency = 1
	self.touchControlFrame.Parent = self.touchGui

	self.touchGui.Parent = self.playerGui
end

function ControlModule:GetClickToMoveController()
	if not self.controllers[ClickToMove] then
		self.controllers[ClickToMove] = ClickToMove.new(CONTROL_ACTION_PRIORITY)
	end
	return self.controllers[ClickToMove]
end

return ControlModule.new()
