Skip to main content
Register events with Script.on(eventName, callback).

Events

render2d draws behind any open screen (chat, inventory, etc.), same as other HUD content. render2d_top has the identical payload but draws after the screen finishes rendering, so it appears on top — use it for overlays that need to stay visible while a screen is open, like a chat link preview. sound_play fires for every sound the client plays — both server-broadcast and locally-triggered (entity hurt/step/ambient) — so it can fully replace matched sounds via cancel() plus Sound.play(...). Selvut’s own custom sounds are excluded from the event so a replacement can’t trigger itself again. chat fires for every line that actually renders in chat (visible chat), not only messages that came from the server (true chat). It’s intentionally broader than what client modules react to internally, so a script can see chat content a module wouldn’t. Packet event objects include direction, className, simpleName, type, raw, and cancel(). System chat packets also include text and overlay. Cancelable packet callbacks may run off the client thread. Keep them short and avoid client-state APIs from those callbacks.