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(J)if J~=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(J)if J~=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)

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)

