Mycode PHP: public function garageMenu($player) { $owner = $player->getName(); $getgarage = new Config($this->getDataFolder() . "garage/" . $owner . ".yml", Config::YAML, array()); $listvehicles = $getgarage->getAll(); $vehiclename = $getgarage->getAll(); $vehicleplugin = $this->getServer()->getPluginManager()->getPlugin(" Vehicles"); $form = $this->getServer()->getPluginManager()->getPlugin("FormAPI")->createSimpleForm(function(Player $player, ?int $result) use ($listvehicles, $owner) { if($result === null) return; if(isset($vehiclename[$result])) { //click button NotWork $buttonVehicle = $vehiclename[$result]; $cartype = $this->getType($owner, $buttonVehicle); $uidvehicle = $this->getUidVehicle($owner, $buttonVehicle); Factory::spawnVehicle($vehicleplugin->factory->getVehicleData($cartype), $player->getLevel(), $player->asVector3(), 1, $player->getName(), $uidvehicle); $this->removeToGarage($owner, $buttonVehicle); // Do whatever with him } }); $form->setTitle("§fGODMCPE - Garage"); foreach($listvehicles as $vehiclename => $listvehicles) { $caruse = $getgarage->getAll()[strtolower("$vehiclename")]["use"]; $getalive = $getgarage->getAll()[strtolower("$vehiclename")]["alive"]; if(($caruse) == 0){ if(($getalive) == 1){ $carname = $this->getNames($owner, $vehiclename); $form->addButton($carname); } } } $form->sendToPlayer($player); } Help Me I use FormAPI
Here's also a template on using SimpleForm PHP: public function testForm($player) { $form = new SimpleForm(function (Player $player, $data) { if($data === null) { //The form has been closed by the player return true; } switch($data) { case 0: //First Button //Here is where you add the code to what this button will do. break; case 1: //Second Button //Here is where you add the code to what this button will do. break; } }); $form->setTitle("Title of the form"); //This sets the title of the form $form->addButton("First Button"); //This adds a button $form->addButton("Second Button"); $player->sendForm($form); //This sends it to the player} Source: https://pocketmineschool.netlify.app/tutorials/htufa/simpleform