Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

defineLeaderboards

defineLeaderboards<Boards>(boards): Leaderboards<Boards>

Declares a game’s leaderboards, at module scope: each board under its camelCase key, which is its identity once published. A board with no key and no world is its own handle; a keyed board, or one whose parent is a world, names its handles with for. Throws for a key that is not camelCase and for a board the platform would refuse, naming the fix.

Type Parameter
Boards extends Record<string, LeaderboardOptions>
Parameter Type
boards Boards

Leaderboards<Boards>

export const leaderboards = defineLeaderboards({
fastestLap: {
name: "Fastest lap",
writtenBy: "room",
keyed: true,
sortOrder: "ascending",
unit: "milliseconds",
update: "best",
period: "weekly",
},
});
submitScore(step, leaderboards.fastestLap.for("sunset-loop"), player, 71400);