Skip to content
Untitled Sandbox - Developer Documentation
docs/api/sequence

@usbx/sequence

Cutscenes on a timeline

local sequence = require("@usbx/sequence")

sequence.play

function

Plays a Sequence for the players and returns it at once. Its markers and completed fire at their times.

sequence.play(target: Target?, definition: SequenceDefinition) -> Sequence
example
local run = sequence.play(player, { duration = 3, tracks = { sequence.caption({ { time = 0.5, text = "Ready?" } }) } })

Use it forplaying an intro cutscene for a player the moment they reach the boss room.

targetoptionalOne player, a list of players, or nil for every player in the game now.
definitionThe duration, the tracks and the markers.
Build a play callduration · tracks · markers
  • durationrequired

    How long the sequence plays in seconds, which must be above 0 and at most 300.

  • tracks

    The tracks to play, made with functions like sequence.camera and sequence.caption, up to 16 of them with at most one camera track.

  • markers

    Up to 64 named moments that fire marker on the server, where each name has 1 to 64 characters.

sequence.camera

function

A camera track: the shots of the Sequence's players. A Sequence has at most one.

sequence.camera(keys: { SequenceKey }) -> SequenceTrack
example
local shot = sequence.camera({ { time = 0, position = math3d.vector3.new(0, 5, 20), look_at = door.position }, { time = 3, position = math3d.vector3.new(8, 3, 6), look_at = door.position, easing = "sine_in_out" } })

Use it forflying the camera around the arena to show it off before a round starts.

keysCamera keys in time order: time, position and look_at, and fov, easing or cut.

sequence.caption

function

A caption track: lines of text at the bottom of the screen.

sequence.caption(keys: { SequenceKey }) -> SequenceTrack
example
local line = sequence.caption({ { time = 0.5, text = "[b]Sensei![/b] You made it." }, { time = 2.5, text = "Now watch.", duration = 1.5 } })

Use it forshowing a character's lines at the bottom of the screen during a story cutscene.

keysCaption keys in time order: time and text, and duration.

sequence.effect

function

An effect track: explosions that only the Sequence's players see.

sequence.effect(keys: { SequenceKey }) -> SequenceTrack
example
local blast = sequence.effect({ { time = 2, position = door.position, size = 8 } })

Use it forblowing up the gate at an exact moment in a cutscene.

keysEffect keys in time order: time, position and size, and effect or color.

sequence.time_scale

function

A slow-motion track. Slows what the Sequence's players see.

sequence.time_scale(keys: { SequenceKey }) -> SequenceTrack
example
local slow = sequence.time_scale({ { time = 1, scale = 0.3 }, { time = 2, scale = 1, easing = "quad_out" } })

Use it forslowing down the final hit of a boss fight.

keysTime-scale keys in time order: time and scale, 0.1 to 2, and easing or cut.

sequence.tween

function

A tween track: moves, turns, colors or fades an instance, for every player. An instance has at most one tween track in a Sequence.

sequence.tween(instance: Instance, keys: { SequenceKey }) -> SequenceTrack
example
local lift = sequence.tween(door, { { time = 0, position = door.position }, { time = 2, position = door.position + math3d.vector3.new(0, 8, 0), easing = "quad_out" } })

Use it forraising a door or moving a platform as part of a cutscene.

instanceThe instance the track moves, for every player.
keysTween keys in time order: time and a position, rotation, color or transparency, and easing or cut.
↑ ↓ moveEnter openEsc close