Skip to content

API reference

Rally game scripts are TypeScript, and everything they use comes from one module:

import { Part, Players, Vector3, task, workspace } from '@rally/sdk';

Start with Globals for the full list of exports. The rest of this reference has a page for every class and service; Data types, Enums and Limits cover the values they use.

Each class page starts with what the class is for and a few facts:

  • Inherits lists its base classes. Members inherited from them are listed at the end of each section, with links to where they’re documented.
  • Creatable says whether scripts can make one with new (for example new Part()) or Instance.new('Part', parent). Services, players and characters are made by the engine; scripts are added in Rally Studio.
  • Replication says whether the server sends the object to players’ devices at all.

Each property lists its type and default, and:

  • Access: read/write properties can be assigned. Read-only ones are set by the engine; assigning one throws a TypeError.
  • Range: numbers outside the range are clamped to it when you assign them.
  • Replicates: whether a change the server makes is sent to players’ devices (about 20 times a second). A change made on a player’s device never reaches the server or other players.

Assignments are checked: a value of the wrong type (a string for a number, an unknown enum value, an instance of the wrong class) throws a TypeError that names the property and what it expects. Value types such as Vector3 and Color3 are immutable: build a new value and assign it.

Methods and events show their signatures in TypeScript. Every event is a Signal: connect a function to it with connect.

Page What it is
Globals Everything a game script imports from @rally/sdk: the game’s services, the scheduler, value types, helper functions and every class.
task Game-time scheduling: wait, delay, defer and spawn work without timers.
RunService Per-step events (heartbeat, stepped, renderStepped) and where the code is running.
UserInputService Keyboard and mouse input on the player’s device.
HttpService Unique ids and JSON helpers.
Debris Removes objects later, even if the script that asked stops first.
Live State that survives code changes in a Build live session: hand state to the next version of a script, and read what the last one handed over.
Page What it is
DataModel The root of the game tree, game: every service is a child of it.
Workspace The world: every part, model, character and terrain that exists physically lives here.
Players Everyone in the game: one Player object per connected person.
Lighting The sky, the sun, ambient light and fog.
ReplicatedStorage Shared storage that the server and every player can see: remotes, shared values and templates.
ServerStorage Server-only storage: objects here are never sent to players.
ServerScriptService Where server Scripts live.
StarterGui UI that every player gets a copy of when they join.
StarterPlayer Defaults for new characters, and (inside it) the client scripts every player runs.
StarterPlayerScripts LocalScripts here run on every player’s device.
Service The base class of the fixed services under game: Workspace, Players, Lighting and the rest.
Page What it is
Instance The base class of every object in a game: parts, models, scripts, UI, services and the game itself.
Page What it is
BasePart The base class of everything physical in the world: Part, SpawnLocation and MeshPart.
Part A box, ball, cylinder or capsule: the building block of worlds.
SpawnLocation A part characters spawn on top of.
MeshPart A part that shows a 3D model loaded from a .glb or .gltf file.
Model Groups parts that belong together, such as a car or a house, so you can move them as one.
Folder A container for organizing instances.
Terrain Rolling ground made from a height map: hills, valleys and ramps that you sculpt in Rally Studio or from scripts.
PointLight A light that shines in every direction from the part it’s in.
Sound Plays audio from a URL, either everywhere or from a spot in the world.
Page What it is
Constraint The base class of physics joints between two parts: weld, hinge, spring and rope.
WeldConstraint Rigidly joins two parts as they are right now: they keep their offset and move as one.
HingeConstraint Lets one part turn around an axis through a pivot point: doors, wheels, fans and trapdoors.
SpringConstraint A spring between two parts that pulls or pushes them toward a rest length apart: bounce pads and suspension.
RopeConstraint Keeps two parts at most a given distance apart: swings, tethers and chains.
Page What it is
Animation Keyframe animation of properties: moving platforms, swinging doors, blinking lights.
TweenService Animates number, Vector3, Vector2 and Color3 properties smoothly from their current values to new ones.
Tween One property animation, made by TweenService.create.
Page What it is
Player Someone in the game: one Player per connected person, inside Players.
Character A player’s body in the world.
PlayerGui A player’s on-screen UI.
Camera What a player sees.
Page What it is
ScreenGui A layer of on-screen UI: put GUI objects inside it.
GuiObject The base class of on-screen UI elements: a rectangle with a position, a size and a background.
Frame A plain rectangle: panels, bars and backgrounds.
TextLabel Text on screen.
TextButton A button with text that players click or tap.
TextBox A text field players can type in.
ImageLabel An image on screen.
Page What it is
NumberValue Holds a number that scripts and players can read and watch.
StringValue Holds a string that scripts and players can read and watch.
BoolValue Holds true or false, for scripts and players to read and watch.
ObjectValue Holds a reference to another instance.
Page What it is
RemoteEvent Sends one-way messages between the game server and players’ devices.
RemoteFunction Lets a player’s device call the game server and wait for an answer.
BindableEvent An event that scripts on the same side, server or client, can fire and listen to.
Signal An event: connect a function to it, and the function runs every time the event fires.
Connection The link between a Signal and a handler: disconnect it to stop the handler.
Page What it is
Behavior Ready-made game logic: put it in the part or model it acts on and tune its settings.
MovingBehavior Base class of the behaviors that move or recolor what they’re in (Spinner, Mover, Floater, ColorCycle).
Spinner Spins the part or model it’s in, forever.
Mover Moves the part or model it’s in to an offset and back, carrying anyone standing on it.
Floater Bobs the part or model it’s in up and down.
ColorCycle Fades the part or model it’s in between its own color and another, over and over.
Hazard Hurts characters that touch the part it’s in (lava, spikes), again every cooldown while they stay.
Checkpoint Makes the part it’s in the respawn point of each player who touches it.
Teleporter Sends players who touch the part it’s in to another part.
JumpPad Launches players who step on the part it’s in upward.
SpeedPad Makes players who touch the part it’s in faster for a while.
Collectible Picked up on touch (a coin, a gem): adds to the player’s stat, hides, and comes back later.
Leaderstat Gives every player a stat (a NumberValue in their leaderstats folder), shown in the player list.
Door Slides the part or model it’s in open and shut again: on touch, when someone’s near, or when set off.
Trigger A button: touching the part it’s in sets off, turns on, turns off or toggles behaviors elsewhere.
Spawner Makes copies of a template on a timer, on top of the part it’s in (they go when it stops).
Chaser Makes the part or model it’s in chase the nearest player in range and hurt them on touch.
Goal The finish: shows a message, gives a reward and sends the player back to the start.
RoundTimer A countdown every player sees; at zero it shows a message and can start the round over.
Page What it is
Script Code that runs on the game server.
LocalScript Code that runs on each player’s device.
ModuleScript Shared code that Scripts and LocalScripts import.
Page What it is
DataStoreService Saved data that outlives game servers: progress, inventories and high scores.
DataStore A named store of saved values, read and written by key.
OrderedDataStore A data store whose number values you can rank, for leaderboards.