NEOLearn

Parts, lights, labels and sounds

The world classes a game can expose to scripts (Part, Light, TextLabel, Sound, Camera, Player moves) and the raycast and overlap queries, with every field, range and rate.

Updated October 20, 2026

On this page

NEO's neo_classes crate gives games a set of ready-made kinds that scripts can create and control: shapes, lights, text, sounds and camera effects, plus world queries. A game adds the plugin, then grants what it wants in neo.toml, separately for its own scripts and for each player role. As with any kind, nothing is reachable until it's granted (see Exposure and permissions).

Colours are strings like "#ff8800". Rotations are in degrees: x pitch, y yaw, z roll. Positions and sizes are in metres.

Part#

A primitive shape in the world. Collidable parts block the character, where the game supports it, and are hit by scripts' raycasts and overlaps.

FieldTypeRangeMeaning
position{x, y, z}Where it is.
shapestring"box", "sphere", "cylinder", "wedge"A wedge is a ramp rising toward −X.
size{x, y, z}0.05–200 eachAlong its own axes; a sphere's diameter is the largest.
rotation{x, y, z}−3600–3600 eachDegrees: pitch, yaw, roll.
colorstring"#rrggbb".
roughnessnumber0–10 is a mirror, 1 is matte.
metallicnumber0–1Metalness.
anchoredbooleanStays put. Unanchored parts are simulated by the game's physics, when it has one.
visiblebooleanDrawn.
collidablebooleanBlocks the character and queries.
namestringA name for scripts and the editor.
tagsstring listTags scripts can look for (part.tags.includes("lava")).

destroy() removes it (at most 20 calls per second). A player can only destroy what their own scripts spawned.

JavaScript
const step = this.spawn("Part", {
  shape: "box", size: { x: 2, y: 0.4, z: 2 }, color: "#ff8800",
  position: { x: 0, y: 1, z: 4 }, tags: ["step"],
});

Light#

FieldTypeRangeMeaning
position{x, y, z}Where it is.
kindstring"point", "spot", "directional"
colorstring"#rrggbb".
intensitynumber0–1001 is a bright bulb; for a directional light, 1 is overcast daylight.
rangenumber0.1–200How far a point or spot light reaches, in metres.
anglenumber1–89A spot light's cone half-angle, in degrees.
enabledbooleanOn.
rotation{x, y, z}−3600–3600 eachThe light shines along its forward; the default −90 pitch points straight down.

destroy() as for parts. Daylight scenes are bright, so a small point light shows mostly as a pool of colour on nearby surfaces.

TextLabel#

Text over a position in the world, or fixed on the screen.

FieldTypeRangeMeaning
position{x, y, z}Where it floats, when not on the screen.
textstringAt most 200 characters are shown.
colorstring"#rrggbb".
sizenumber6–96Text size in pixels.
visiblebooleanShown.
screenbooleanFixed on the screen at (screenX, screenY) instead of over its position.
screenXnumber0–10 is the left edge, 1 the right.
screenYnumber0–10 is the top, 1 the bottom.

destroy() as for parts.

Sound#

FieldTypeRangeMeaning
position{x, y, z}Where it plays from.
clipstringA clip in the game's sound bank, or a built-in cue: "ui_move", "ui_confirm", "ui_back".
volumenumber0–1Level.
pitchnumber0.25–4Playback rate: 1 as recorded, 2 an octave up.
loopedbooleanLoops until stopped.
playingbooleanread-onlyA looped sound is playing.

play() and stop() (at most 8 calls per second each), and destroy().

Camera#

There is one Camera, for the local player's view. Scripts can't spawn it.

MemberMeaning
fovThe current field of view, in degrees (read-only).
shake(amount)Shakes the view, amount 0–1. At most 4 calls per second.
fovPunch(degrees)Briefly widens (positive) or narrows (negative) the view, −30 to 30. At most 4 calls per second.

A player's script only affects that player's own camera.

Player moves#

Games built on the gameplay kit add these to Player:

MemberMeaning
walkSpeedThe character's walk speed factor (read-only).
teleport(position)Moves the character. The game refuses positions outside its allowed area, and in multiplayer the host approves the move.
setWalkSpeed(factor)Changes the walk speed; the game clamps it to the range its animations look right in.
emote(name)Plays an emote or animation by name.

A player's script only moves that player's own character.

World queries#

Two methods on World (this in JavaScript, self in Python), each granted separately:

MethodReturnsGrant
raycast(origin, direction, maxDistance){ point, normal, distance, entity } or nullWorld.raycast:call (at most 120 per second)
overlap(center, radius)every entity whose shape touches the sphereWorld.overlap:call (at most 30 per second)

They test against the game's level geometry and its collidable parts, as they were at the start of the tick: a part spawned this tick is found from the next one. The answer is the same on every machine.

JavaScript
const hit = this.raycast(me.position, { x: 0, y: -1, z: 0 }, 10);
// reading hit.entity.tags needs the Part.tags:get grant
if (hit && hit.entity?.tags?.includes("lava")) this.log("standing over lava");

Granting to players#

A player grant can narrow a range and say which objects it reaches:

neo.toml
[script.players]
allowed = "everyone"
max_spawned = 16          # objects one player's scripts may have at once (default 32)

[script.roles.player]
grant = [
  "Part:spawn", "Part.position:get set", "Part.size:get set range=0.1..=3", "Part.destroy:call",
  "Light:spawn", "Light.intensity:get set range=0..=10",
  "World.raycast:call",
]

[script.roles.builder]
grant = ["Block.position:set any", "World.overlap:call"]
  • range=a..=b narrows writes to that range, inside the range the game declares. A write outside it is refused with an error the script can catch.
  • owned and any say which objects a player's grant reaches. By default a player's field writes reach only what that player's scripts spawned (owned), and method calls reach any object (any), because methods check who is calling themselves. Add any to a field grant to let a role change the game's own objects, as builder does above. The game's own scripts always reach everything.
  • max_spawned caps how many objects one player's scripts may have at once.

See also#