FalconFalcon
Docs menuForms and scoreboards

Packs and scripting

Forms and scoreboards

Forms

import { world } from "@minecraft/server";
import { ActionFormData } from "@minecraft/server-ui";

world.afterEvents.itemUse.subscribe((event) => {
  new ActionFormData()
    .title("Menu")
    .body("Pick one")
    .button("Spawn")
    .button("Shop")
    .show(event.source)
    .then((response) => {
      if (!response.canceled) console.log(response.selection);
    });
});
ClassMethods
ActionFormDatatitle, body, button(text, icon), show. header, label and divider are accepted and ignored
MessageFormDatatitle, body, show
ModalFormDatatitle, textField(label, placeholder, defaultValue), toggle(label, defaultValue), slider(label, min, max, step, defaultValue), dropdown(label, options, defaultIndex), label, header, divider, submitButton, show

Form responses are limited by max-form-responses-per-second.

Scoreboard

world.scoreboard manages objectives. ScoreboardObjective has getScore, setScore, addScore, removeParticipant, hasParticipant and getParticipants.