Task: <?php namespace HumChange; use pocketmine\scheduler\Task; use pocketmine\level\particle\FloatingTextParticle; use pocketmine\math\Vector3; use pocketmine\level\Level; Class text extends Task{ public function __construct(Main $plugin){ $this->plugin = $plugin; $this->s = 10; $this->text = new FloatingTextParticle(new Vector3(267,6,279), "", "Text"); } public function onRun($currentTick){ $text = new FloatingTextParticle(new Vector3(267, 6, 279), "","§eTest"); $text1 = new FloatingTextParticle(new Vector3(267,6,279), "","Test"); if($this->s < 5){ $this->text->setText("§eT§ae§bx§ct"); $level = $this->plugin->getServer()->getLevelByName("Lobby2"); $level->addParticle($this->text); $this->s = 10; } if($this->s >= 5){ $this->text->setText("Text"); $level = $this->plugin->getServer()->getLevelByName("Lobby2"); $level->addParticle($this->text); } $this->s--; } } Main: <?php namespace HumChange; use pocketmine\Server; use pocketmine\Player; use pocketmine\plugin\PluginBase; use HumChange\text; use pocketmine\level\Level; use pocketmine\math\Vector3; use pocketmine\level\particle\FloatingTextParticle; use pocketmine\event\Listener; use pocketmine\scheduler\PluginTask; use pocketmine\event\player\PlayerJoinEvent; Class Main extends PluginBase implements Listener{ public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); $this->getScheduler()->scheduleRepeatingTask(new text($this), 20); } }
it is necessary that your 2 variables become variables or the file can access (a property visibility) Doc: https://www.php.net/manual/en/language.oop5.visibility.php That is to say that your variables $text and $text1 become like your property visibility $this->text