Skip to main content

Scoreboards, Teams, and Boss Bars

Score functions take the objective name first, then the score holder. A holder can be an entity handle or a scoreboard name. Writing a score returns its previous value.

Objectives and scores​

Call under mc.scoreboardResult
scoreboard()Objective names.
scoreboard(objective)Names of holders with scores for that objective, or null for an unknown objective.
scoreboard(objective, holder)Current score, or null if absent.
scoreboard(objective, holder, value)Writes an integer score and returns the previous score. Pass null as the value to reset that score.
scoreboard_add(objective[, criterion])Adds an objective. The default criterion is "dummy".
scoreboard_remove(objective[, holder])Removes an objective or a holder's score for it.
scoreboard_property(objective, property[, value])Reads or changes criterion, display_name, display_slot, or render_type.
scoreboard_display(slot, objective)Shows an objective in a slot such as "sidebar". Pass null to clear the slot.
function setDemoScore() {
const sb = mc.scoreboard;
if (!sb.scoreboard().includes("carpet_demo")) {
sb.scoreboard_add("carpet_demo");
}
sb.scoreboard("carpet_demo", "example", 5);
return sb.scoreboard("carpet_demo", "example");
}

Teams and boss bars​

Call under mc.scoreboardUse
team_list([team])Lists teams or the named team's members.
team_add(team[, holder])Creates a team or adds a holder to an existing team.
team_remove(team), team_leave(holder)Removes a team or makes a holder leave its team.
team_property(team, property[, value])Reads or changes a team property such as color.
bossbar(), bossbar(id)Lists IDs or creates a bar for an unused ID such as "example:progress".
bossbar(id, property[, value])Reads or changes properties such as value, max, name, players, color, style, and visible. Use bossbar(id, "remove") to remove the bar.