Class in @minecraft/server
Someone with a score: a player, an entity, or a fake player who’s only a name.
import { ScoreboardIdentity } from '@minecraft/server';Example
Section titled “Example”import { world, type ScoreboardIdentity } from '@minecraft/server';
for (const player of world.getAllPlayers()) { const scoreboardIdentity: ScoreboardIdentity | undefined = player.scoreboardIdentity; console.log(player.name, scoreboardIdentity?.id);}import { world } from '@minecraft/server';
for (const player of world.getAllPlayers()) { const scoreboardIdentity = player.scoreboardIdentity; console.log(player.name, scoreboardIdentity?.id);}Properties
Section titled “Properties”read-only
readonly id: number;The scoreboard’s id for them.
read-only
readonly type: ScoreboardIdentityType;displayName
Section titled “displayName”read-only
readonly displayName: string;A player’s name, Player Offline for one not seen this session, or a fake player’s name.
isValid
Section titled “isValid”read-only
readonly isValid: boolean;False once they hold no score.
Methods
Section titled “Methods”getEntity
Section titled “getEntity”getEntity(): Entity | undefined;The player, while online. undefined for entities and fake players in Basalt.
Returns
Entity | undefinedTypes
Used by
Section titled “Used by”Entity.scoreboardIdentity, ScoreboardScoreInfo.participant, ScoreboardObjective.getParticipants, Scoreboard.getParticipants