PlayerUi type
player.ui: the calls ui has, for one player alone, plus what only one player's screen holds.
Ui
Functions 4
playerUi.menu(opts: { title: Text?, items: { ItemSpec }, on_pick: (player: Player, n: number) -> (), on_close: ((player: Player) -> ())?, }) → MenuA titled grid of up to 54 items over the player's view; each pick is answered by on_pick(player, n). Nothing goes in or out of it: the items are pictures, not stacks. A chest on Java, a form of buttons on Bedrock. on_close fires when the player puts it away without picking. A new menu replaces the open one.
playerUi.overlay(opts: { corner: ("top_left" | "top_right" | "bottom_left" | "bottom_right")?, size: number?, margin: number? }?) → Overlay?Puts a canvas in a corner of this player's screen, size screen pixels square at GUI scale 1 (96 by default, 16 to 511), margin from the edges (4 by default); nil where player:supports("overlay") is false.
playerUi.show(layout: Layout) → HudPuts a layout on this player's screen. A client older than 1.21.4 (player:supports("layout")) gets a handle that shows nothing.
playerUi.dialog(view: DialogNode | () -> DialogNode) → Dialog?A screen of boxes, words and pictures (see "Dialogs"): a ui.kit.window{}, or a function that returns one and is drawn again after every click. nil where player:supports("dialog") is false.