Hi, I'm trying to teleport player to x = 1 y = 1 z = 1 this is my code PHP: $pos = new Vector3(1, 1, 1);$player->setLevel($this->getServer()->getLevelByName("world"));$player->teleport($pos);var_dump("working"); The console says working but the player did not teleported
Is $player an instance of \pocketmine\Player? Do you have PHP: use pocketmine\math\Vector3 at the top of your life? If not, try changing Vector3 to \pocketmine\math\Vector3. Do you get any errors? Also, try setting debug to 2 in pocketmine.yml
It's not the best practice to use setLevel() as far as I know. (citation required) This is what the teleport function is made for. Instead of creating a vector3 and setting the level, you can create a new Position and teleport the player there. In code: PHP: $pos = new Position(1, 1, 1, $this->getServer()->getLevelByName("world"));$player->teleport($pos);
The error occures, but as far as I know the actual teleporting works fine. I myself haven't had any trouble with the actual teleporting yet, except for the error showing up.