Uploaded image for project: 'Bedrock Dedicated Server'
  1. Bedrock Dedicated Server
  2. BDS-18964

Cannot call functions in a beforeEvent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Awaiting Response
    • None
    • 1.20.51
    • None
    • Unconfirmed

      Mojang please fix this, it is limiting us developers and causing immeasurable headaches. I'm tired of having to come up with dumb workarounds that bloats my code, wrapping my code in a system.run() that doesn't work half the time, and giving up on some projects because I'm unable to call some functions in a beforeEvent. 

       

      Tested JS Code:
      world.beforeEvents.playerLeave.subscribe(({ player }) =>

      { // teleporting a player back to spawn when they leave     player.teleport(new Vector(0, 0, 0)) }

      )

       

      Affects @minecraft/server version 1.3.0-beta and up
       
      Expected Result: Player is teleported to 0, 0, 0 before they leave the realm.
      Actual Result: [Scripting][error]-ReferenceError: Native function [Entity::teleport] does not have required privileges.    at <anonymous> (main.js:33)
       
      Every function that sets something does not work in a beforeEvent.

            Unassigned Unassigned
            AncientNewJersey AncientNewJersey
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: