-- why do I need a wait here?!?!?!? Sometimes touch controls don't disappear without this

wait()
if UserInputService:GetGamepadConnected(Enum.UserInputType.Gamepad1) then
	if CurrentControlModule and IsTouchDevice then
		CurrentControlModule:Disable()
	end
	if isJumpEnabled and IsTouchDevice then TouchJumpModule:Disable() end

	ControlModules.Gamepad:Enable()
end

UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
	if gamepadEnum ~= Enum.UserInputType.Gamepad1 then return end
	
	if CurrentControlModule and IsTouchDevice then
			CurrentControlModule:Enable()
	end
	if isJumpEnabled and IsTouchDevice then TouchJumpModule:Enable() end
	
	ControlModules.Gamepad:Disable()
end)

UserInputService.GamepadConnected:connect(function(gamepadEnum)
	if gamepadEnum ~= Enum.UserInputType.Gamepad1 then return end
	
	if CurrentControlModule and IsTouchDevice then
		CurrentControlModule:Disable()
	end
	if isJumpEnabled and IsTouchDevice then TouchJumpModule:Disable() end
	
	ControlModules.Gamepad:Enable()
end)

