Recipes
Copy something that works
Working scripts for the things people actually build. Every one is complete: copy it onto an object and it runs.
Never done this before? Start with Your first script, then come back.
Things you click and walk into#
Things players hold#
Talking to players#
The world itself#
Plumbing#
Five habits worth copying#
They show up in nearly every recipe here.
Check before you use. Anything that can answer nil deserves the check, and the shape is always the same:
local part = self:part("hinge")if not part then return endAsk the engine, do not remember. self:held_at(), player.holding, self:get(...). A local copy of the world's state goes stale the moment something happens by a route your script does not run.
Act on the change, not on the tick. A timer that writes the same properties every second spends the region's budget for nothing.
if should ~= current then current = should apply(current)endSave a timestamp, not a countdown. world:clock() keeps running while the world is off, so a stored moment is still true after a weekend. A countdown only moves while somebody is ticking it.
Cancel the timer you are replacing. Otherwise clicking twice leaves two of them, and the second one fires into a world that has moved on.
See also#
- API reference has every option of everything used here
- When nothing happens is for when a recipe does not behave
Updated 17 October 2026