I have this code: PHP: public function onInteract(PlayerInteractEvent $event){ $player = $event->getPlayer(); $block = $event->getBlock(); $level = $this->getServer()->getDefaultLevel(); if($block->getId() == 46) { if($this->mode>=0&&$this->mode<=1000) { $this->mode++; $this->text = new FloatingTextParticle(new Vector3(77, 48, -892), ""); $this->text->setText("§bYour score: §6" . $this->mode . ""); $level->addParticle($this->text); } } }} The problem with this is that the floating text dose not update.. it just spawns another floating text. how can I just make it update the text?
solved it myself before a reply. there's no point deleting this, I'll leave it here in case anyone has this problem in the future. fix: onEnable: PHP: $this->text = new FloatingTextParticle(new Vector3(77, 48, -892), "", ""); onInteract: PHP: public function onInteract(PlayerInteractEvent $event){ $player = $event->getPlayer(); $block = $event->getBlock(); $level = $this->getServer()->getDefaultLevel(); if($block->getId() == 46) { if($this->mode>=0&&$this->mode<=1000) { $this->mode++; $this->text->setText("§bYour score: §6" . $this->mode . ""); $level->addParticle($this->text); } } }}