Help to solve this teleport code

  1. Create a boolean right after the first line of your playerMovement script:
    var playerIsTeleporting = false;
  1. Create an if statement right after the first line of the update function of the playerMovement script:
    if (playerIsTeleporting) {
        return;
    }
  1. Set the boolean to true right before teleporting:
    playerIsTeleporting = true;
  1. Set it back to false right after teleporting:
    playerIsTeleporting = false;
1 Like

so i set the boolean in this script?

else if (entity.other.tags.has("player")) {
        var test = this.app.root.findByName("test").getPosition();
        var player = this.app.root.findByName("Player").script.playerMovement;
        playerIsTeleporting = true;
        entity.other.rigidbody.teleport(test);
        console.log("hit");
   }

Yes, that is step 3.