Would anyone be so kind to share with me the way to update a scoreboard score?
Get a Score object from either the Scoreboard or one of its Objectives, and then call setScore on it.
1 Like
For those who seek similar knowledge:
int score = player.getScoreboard().getObjective(DisplaySlots.SIDEBAR).get().getScore(Text.of("Kills")).get().getScore();
player.getScoreboard().getObjective(DisplaySlots.SIDEBAR).get().getScore(Text.of("Kills")).get().setScore(score+1);
Or, you could store the Score directly instead of an int, and then not go through the same string of possibly expensive function calls twice to set it again.