--Mobile support

local mobileGui = script.MobileGui
if userInputService.TouchEnabled then
	userInputService.ModalEnabled = true
	mobileGui.Parent = player.PlayerGui
	
	mobileGui.DrivePad.Up.MouseButton1Down:connect(function()
		movement = Vector2.new(movement.X, 1)
	end)
	mobileGui.DrivePad.Up.MouseButton1Up:connect(function()
		movement = Vector2.new(movement.X, 0)
	end)
	mobileGui.DrivePad.Down.MouseButton1Down:connect(function()
		movement = Vector2.new(movement.X, -1)
	end)
	mobileGui.DrivePad.Down.MouseButton1Up:connect(function()
		movement = Vector2.new(movement.X, 0)
	end)
	mobileGui.TurnPad.Left.MouseButton1Down:connect(function()
		movement = Vector2.new(-1, movement.Y)
	end)
	mobileGui.TurnPad.Left.MouseButton1Up:connect(function()
		movement = Vector2.new(0, movement.Y)
	end)
	mobileGui.TurnPad.Right.MouseButton1Down:connect(function()
		movement = Vector2.new(1, movement.Y)
	end)
	mobileGui.TurnPad.Right.MouseButton1Up:connect(function()
		movement = Vector2.new(0, movement.Y)
	end)
	
	mobileGui.ExitButton.Text = "Exit " .. car.Name
	mobileGui.ExitButton.MouseButton1Click:connect(function()
		character.Humanoid.Jump = true
	end)
else
	mobileGui:Destroy()
end
