Mojira Archive
MCPE-168575

scoreboard.getScore() method does not update scoreboard display

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

Cannot Reproduce

Gassayping33

2023-03-18, 06:15 AM

2024-03-14, 10:30 AM

2024-03-14, 10:30 AM

1

2

Unconfirmed

Script-API

1.19.71

-