--Touch Controls
--I wanted to use the MasterControl module, but the rules for the magnitude of GetMoveVector()
--seem arbitary and unclear, so it's hooked into the ui itself. 

function RunTouchControls()
	local TouchGui = Player.PlayerGui:FindFirstChild("TouchGui")
	local StickOuter = TouchGui.TouchControlFrame.ThumbstickFrame.OuterImage
	local StickInner = TouchGui.TouchControlFrame.ThumbstickFrame.StickImage
	local CenterX = StickOuter.Size.X.Offset/2 - StickInner.Size.X.Offset/2
	local MinX = CenterX - StickOuter.Size.X.Offset/2
	local MaxX = CenterX + StickOuter.Size.X.Offset/2
	local CenterY = StickOuter.Size.Y.Offset/2 - StickInner.Size.Y.Offset/2
	local MinY = CenterY - StickOuter.Size.Y.Offset/2
	local MaxY = CenterY + StickOuter.Size.Y.Offset/2
	while Input.InputMode == "Touch" do
		wait()
		local X = ((StickInner.Position.X.Offset-MinX) / (MaxX-MinX))*2  - 1 
		local Y = ((StickInner.Position.Y.Offset-MinY) / (MaxY-MinY))*-2  + 1 
		Input.LStickX = -X
		Input.LStickY = Y
	end
end
