Skip to content

API reference

Every verb, every option, every refusal.

If you are looking for how do I build X, start with the recipes instead — they link back here for the details.

The six modules

luau
local self    = require("self")
local world   = require("world")
local players = require("players")
local events  = require("events")
local objects = require("objects")
local vec     = require("vec")
local json    = require("json")
local http    = require("http")
ModuleWhat it is
selfthe object your script is inside
worldthe region around it
playerswho is here, and what they are doing
eventsmessages between scripts
objectsacting on other objects
vecpoints, directions and the maths on them
jsonturning a table into text a store can hold, and back
httpcalling a service outside the world

self and objects also work without the require, as ready-made globals. The rest do not — a snippet using world: without requiring it will fail on the first line that touches it.

Writing all six is still worth it: the require is what gives you autocomplete and type checking in VS Code.

Sub-tables

world.terrainsculpting the ground
world.blocksthe cubic volume
world.buildpieces players raise, and what holds them up

Tables and rules

Player and screenHUDs, cursor, crosshair, camera, weapons
HUD referenceevery node, style key and theme value
Object propertiesevery key set accepts
Particlesevery emitter field
Socketsthe eighteen places an object can hang on a body
Permissionswhy a verb answers "permission"
Limits and refusalsevery ceiling and every reason

Conventions

These hold everywhere, so they are worth reading once.

Two answer shapes

A reading hands you the value and never fails:

luau
local here = self:position()
local n = players:count()

An action hands you true (or a useful value), or nil plus a reason:

luau
local ok, why = self:move_to(0, 5, 0)

Three meanings of nil

AnswerMeaning
a valueit worked
nila real answer meaning nothing — no hit, no such item, nobody here
nil, reasonthe call could not be carried out

world:raycast returning plain nil is a clear line of sight, not an error.

Angles are degrees

Everywhere, without exception. rot is the word for an orientation on every verb that takes one.

ease names a curve, smooth counts seconds

ease is always one of "linear", "in", "out", "in_out". smooth is always a number of seconds. Never the other way round.

Points are interchangeable

Anything that takes a point accepts a plain { x =, y =, z = } table or a vec, and every reading hands you a vec. Nothing needs repacking by hand.

Coordinates follow the parent

World coordinates when the object stands alone; local to the parent when it is inside a group.

Names, not hashes

A script refers to what an object holds by name — a sound, a model, a content item. No content hash ever enters a script.

The slash decides which shelf: a bare name lives inside the object and travels with it; world/… lives in the world you are standing in.

Ids, not usernames

player.id is permanent. player.name is a display name the person can change. Use id as a key, always.

See also

Hungrit scripting documentation.