Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-168575

scoreboard.getScore() method does not update scoreboard display

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • None
    • 1.19.71
    • Unconfirmed
    • iOS

      When a scoreboard displayed on the sidebar is changed with the script API’s setScore(), the sidebar does not update. When using runCommandAsync, the scoreboard display updates properly. To replicate this

      1. Have the below script applied to a world
      2. Run "/scoreboard objectives add test dummy test"
      3. Run "/scoreboard objectives setdisplay sidebar test"
      4. Say "set 1 cmd" - player's score shows up as 1 because it was run through runCommandAsync()
      5. Say "set 2 script" - sidebar does not show player's score as 2 even though "/scoreboard players list @s" shows that the player's score is 2
      import { world } from '@minecraft/server';
      
      world.events.beforeChat.subscribe(e => {
          const player = e.sender;
          const message = e.message.split(' ');
          if (!(message[0] === 'set')) return;
          e.cancel = true;
          switch (message[2]) {
              case 'cmd':
                  player.runCommandAsync(`scoreboard players set @s test ${message[1]}`);
                  break;
              case 'script':
                  world.scoreboard.getObjective('test').setScore(player.scoreboard, parseInt(message[1]));
                  break;
          }
      });
      

      Here is a link to a video of my tests on google drive: https://drive.google.com/file/d/1aXpEKWhsgMk_6w5FyBUXjM-JktFCL_FP/view?usp=drivesdk

            Gassayping33 Gassayping33
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: