bool stopp = false; [...] if (!stopp) { DriveTrain.tankDrive(leftJoystick.getY(), rightJoystick.getY()); } if (button.get()) { stopp = true; }