Contains objectives and participants for the scoreboard.
Readonly
Returns the player-visible name of this scoreboard objective.
This property can throw when used.
Identifier of the scoreboard objective.
Participant to apply the scoreboard value addition to.
Adds a score to the given participant and objective.
This function can't be called in read-only mode.
This function can throw errors.
const money = world.scoreboard.getObjective("money");const currentScore = money.addScore(player, 100);player.sendMessage(`Your current score is ${currentScore}`); Copy
const money = world.scoreboard.getObjective("money");const currentScore = money.addScore(player, 100);player.sendMessage(`Your current score is ${currentScore}`);
const money = world.scoreboard.getObjective("money");const currentScore = money.addScore(player, -100);player.sendMessage(`Your current score is ${currentScore}`); Copy
const money = world.scoreboard.getObjective("money");const currentScore = money.addScore(player, -100);player.sendMessage(`Your current score is ${currentScore}`);
Returns all objective participant identities.
Identifier of the participant to retrieve a score for.
Returns a specific score for a participant.
Returns specific scores for this objective for all participants.
import { world } from "@minecraft/server";const money = world.scoreboard.getObjective("money");var scoreArray = money.getScores();scoreArray.sort(function (a, b) { return b.score - a.score;});console.log(scoreArray.map((score) => score.participant.displayName)); Copy
import { world } from "@minecraft/server";const money = world.scoreboard.getObjective("money");var scoreArray = money.getScores();scoreArray.sort(function (a, b) { return b.score - a.score;});console.log(scoreArray.map((score) => score.participant.displayName));
Returns if the specified identity is a participant of the scoreboard objective.
Returns true if the ScoreboardObjective reference is still valid.
Participant to remove from being tracked with this objective.
Removes a participant from this scoreboard objective.
Identity of the participant.
New value of the score.
Sets a score for a participant.
const money = world.scoreboard.getObjective("money");money.setScore(player, 0);player.sendMessage(`Your score has been reset.`); Copy
const money = world.scoreboard.getObjective("money");money.setScore(player, 0);player.sendMessage(`Your score has been reset.`);
Contains objectives and participants for the scoreboard.