API reference
Entity
Anything in the world: a part, a light, a sound, a group.
| Property | Type | Access | Description |
|---|---|---|---|
name | string | read, write, replicated, saved | What it is called. Names need not be unique. |
parent | Entity? | read, write, replicated, saved | What it hangs from. Destroying the parent destroys it too. |
| Signal | Arguments | Description |
|---|---|---|
destroying | | Fires just before it is destroyed. |
| Method | Returns | Description |
|---|---|---|
:destroy() | nothing | Removes it, and everything under it. |
:children() | any | The entities directly under it, as a list. |
:find(name: string) | Entity? | The first child with this name, or nil. |
:is_a(class: string) | boolean | True when it is this class or one that extends it. |
:watch(property: string) | any | A signal that fires with (new, old) whenever the property is set. |
:add(component, fields?) | the new data | Gives it a component, with these fields over the component's defaults. |
:get(component) | the data, or nil | Its data for a component. Change the fields directly. |
:has(component) | boolean | Whether it has the component. |
:remove(component) | boolean | Takes the component off. True when it had it. |
:attach(behavior, params?) | the running instance | Starts a behavior on it, with these parameters over the defaults. |
:tween(properties, seconds, easing?) | a Tween | Moves number and vector properties to new values over time. Easing: linear, in, out, inout. |
Group
A container for organizing other entities. It has no body of its own.
Extends Entity.
| Property | Type | Access | Description |
|---|---|---|---|
kind | string | read, saved | What the place calls it: Folder or Model. |
Part
A solid shape in the world.
Extends Entity.
| Property | Type | Access | Description |
|---|---|---|---|
position | vector | read, write, replicated, saved | Where the center is, in studs. |
size | vector | read, write, replicated, saved | How big it is along each axis. (0.05 to 1000000) |
rotation | vector | read, write, replicated, saved | Orientation, read and written as XYZ Euler angles in degrees. Reads may return equivalent angles. |
color | vector | read, write, replicated, saved | Red, green and blue, each from 0 to 1. (0 to 1) |
transparency | number | read, write, replicated, saved | 0 is solid to the eye, 1 is invisible. (0 to 1) |
anchored | boolean | read, write, replicated, saved | True: it stays where it is. False: physics moves it. |
solid | boolean | read, write, replicated, saved | True: things collide with it. |
shape | string | read, write, replicated, saved | The shape: Block, Ball, Cylinder or Wedge. Unknown names draw and collide as a block. |
material | string | read, write, replicated, saved | The surface material. Concrete, Wood and Grass add a tiled texture. |
friction | number | read, write, replicated, saved | How much a loose part grips what it slides on: 0 is ice, 0.6 is normal, 1 is rough. (0 to 10) |
elasticity | number | read, write, replicated, saved | How much a loose part bounces: 0 does not, 1 returns all its speed. (0 to 10) |
mass | number | read, write, replicated, saved | A loose part's mass in kilograms. 0 works it out from the size. (0 to 1000000) |
ladder | boolean | read, write, replicated, saved | True: a character inside it climbs instead of falling. |
| Signal | Arguments | Description |
|---|---|---|
touched | other: Part | Fires when another part starts touching it. |
touch_ended | other: Part | Fires when a part that was touching it stops. |
stepped_on | player: Player | Fires when a player's character starts touching it. |
clicked | player: Player | Fires when a player clicks it, from up to 64 studs away. |
| Method | Returns | Description |
|---|---|---|
:push(impulse: vector) | nothing | Gives it a shove (a loose part). |
Light
A point of light.
Extends Entity.
| Property | Type | Access | Description |
|---|---|---|---|
position | vector | read, write, replicated, saved | Where it shines from. |
color | vector | read, write, replicated, saved | The color of the light. (0 to 1) |
brightness | number | read, write, replicated, saved | How strong it is. (0 to 100) |
range | number | read, write, replicated, saved | How far it reaches, in studs. (0 to 1000) |
rotation | vector | read, write, replicated, saved | Orientation, read and written as XYZ Euler angles in degrees. A spot light shines along its front (-Z). |
angle | number | read, write, replicated, saved | 0 shines every way. Above 0 it is a spot light along its front (-Z) with this cone half-angle in degrees. (0 to 89) |
enabled | boolean | read, write, replicated | Whether it is on. |
Sound
A sound that plays in the world or for a player.
Extends Entity.
| Property | Type | Access | Description |
|---|---|---|---|
asset | string | read, write, replicated, saved | Which sound to play: sound/<id>. |
volume | number | read, write, replicated, saved | How loud, 1 is normal. (0 to 10) |
looped | boolean | read, write, replicated, saved | Whether it starts again when it ends. |
speed | number | read, saved | The saved playback speed, 1 is normal. |
range | number | read, saved | The saved distance in studs past which it is silent; 0 plays it at full volume everywhere. |
playing | boolean | read, replicated, saved | Whether it is playing now. A place saves it, so a sound set to play starts with the game. |
| Method | Returns | Description |
|---|---|---|
:play() | nothing | Starts it from the beginning. |
:stop() | nothing | Stops it. |
Player
Someone playing the game.
Extends Entity.
| Property | Type | Access | Description |
|---|---|---|---|
user_id | number | read | Their account number. Use it, not the entity, as a key in saved data. |
position | vector | read, write, replicated | Where their character is. |
health | number | read, write, replicated | Hit points. Zero means dead. (0 to 100000) |
ping | number | read | The round trip to their game, in milliseconds. |
| Signal | Arguments | Description |
|---|---|---|
died | | Fires when health reaches zero. |
chatted | text: string | Fires when they say something in chat. |
| Method | Returns | Description |
|---|---|---|
:teleport(to: vector) | nothing | Moves their character. |
:tell(text: string) | nothing | Shows them a private chat line. |
:kick(reason: string) | nothing | Removes them from the game. |
Spawn
A part that marks where characters start. A place picks its spawn when the session begins.
Extends Part.
Workspace
The world root and its saved simulation and camera settings.
Extends Group.
| Property | Type | Access | Description |
|---|---|---|---|
gravity | number | read, saved | The saved downward gravity in studs per second squared. |
fallen_parts_destroy_height | number | read, saved | The saved void height in studs. |
air_density | number | read, saved | The saved air density factor. |
global_wind | vector | read, saved | The saved wind vector in studs per second. |
interpolation_throttling | boolean | read, saved | Whether the place requests interpolation throttling. |
camera_fov | number | read, saved | The saved camera field of view in degrees. |
camera_type | string | read, saved | The saved camera mode. |
Lighting
The place's saved sky and lighting settings.
Extends Entity.
| Property | Type | Access | Description |
|---|---|---|---|
clock_time | number | read, saved | The time of day in decimal hours. |
brightness | number | read, saved | The sunlight brightness multiplier. |
sun_azimuth | number | read, saved | The sun's compass direction in degrees. |
sun_elevation | number | read, saved | The sun's angle above the horizon in degrees. |
light_color | vector | read, saved | The sunlight tint. |
ambient_color | vector | read, saved | The saved ambient tint. |
realistic_sky | boolean | read, saved | Whether the place enables the dynamic sky. |
sky_model | string | read, saved | The saved sky model, physical or classic. |
cloud_density | number | read, saved | The saved cloud density from 0 to 1. |
Script
A script kept in the place. Scripts do not read each other's code.
Extends Entity.
| Property | Type | Access | Description |
|---|---|---|---|
kind | string | read, saved | Script, LocalScript or ModuleScript. |
source | string | read, saved | The code, with its --! directives. |
Object
Any other object the place keeps: a remote, a value, a click detector, or one of its settings.
Extends Entity.
| Property | Type | Access | Description |
|---|---|---|---|
kind | string | read, saved | What the place calls it: RemoteEvent, IntValue, Lighting, Atmosphere and so on. |
text | string | read, saved | What it holds: a value, or the JSON of a setting. |
