Skip to main content

Flow

The executor and public runtime API, injected by the plugin at ReplicatedStorage.Flow.

local Flow = require(ReplicatedStorage.Flow)

local playback = Flow:Play("DoorOpen", {
	Bindings = { Door = hitDoor },
	Parameters = { OpenAngle = 90 },
})
playback.Completed:Wait()

Sequences evaluate on the client. A server starts synced playback with Flow:PlayForAll or Flow:PlayFor, which every client (late joiners included) derives from the same shared record.

Types​

SequenceData​

type SequenceData = table

A sequence loaded into the in-memory model the evaluator consumes: its length, fps, bindings, and tracks.

PlayOptions​

interface PlayOptions {
Bindings: {[string]: Instance}?--

Instances for the sequence's bindings, by binding name

Parameters: {[string]: any}?--

Per-play overrides of sequence parameters

Rate: number?--

Playback speed multiplier; defaults to 1

StartTime: number?--

Sequence time to start from; defaults to 0

Root: Instance?--

Overrides the sequence's root for this play

Loop: boolean?--

Restarts from the beginning instead of completing

}

Properties​

Version​

This item is read only and cannot be modified. Read Only
Flow.Version: string

The runtime's semantic version, such as "0.4.0".

Camera​

This item is read only and cannot be modified. Read Only
Flow.Camera: CameraOwnership

The camera handoff contract. See CameraOwnership.

SectionTypes​

This item is read only and cannot be modified. Read Only
Flow.SectionTypes: SectionTypes

TrackTypes​

This item is read only and cannot be modified. Read Only
Flow.TrackTypes: TrackTypes

Presets​

This item is read only and cannot be modified. Read Only
Flow.Presets: Presets

Interpolation​

This item is read only and cannot be modified. Read Only
Flow.Interpolation: Interpolation

Functions​

GetSequenceNames​

Flow:GetSequenceNames() → {string}--

Names of every sequence in the place, sorted

GetSequenceInstance​

Flow:GetSequenceInstance(name: string) → Instance?

Returns the sequence's Configuration under Flow.Sequences, or nil if there is none.

GetSequence​

Flow:GetSequence(name: string) → SequenceData?

Loads a sequence into its in-memory model. Warns and returns nil if it does not exist.

Play​

This item only works when running on the client. Client
Flow:Play(
target: string | Instance | SequenceData,
options: PlayOptions?
) → Playback?

Starts a local playback of a sequence, given its name, its instance, or a loaded sequence. The playback runs on a local clock and is not synchronized with other clients; use Flow:PlayForAll for that.

Warns and returns nil on a running server, or if the sequence cannot be found.

PlayForAll​

This item only works when running on the server. Server
Flow:PlayForAll(
name: string,
options: PlayOptions?
) → SequenceTrack?

Starts a synced playback for every client and returns the SequenceTrack that controls it.

PlayFor​

This item only works when running on the server. Server
Flow:PlayFor(
player: Player,
name: string,
options: PlayOptions?
) → SequenceTrack?

Starts a synced playback for one player and returns the SequenceTrack that controls it.

GetActivePlaybacks​

This item only works when running on the client. Client
Flow:GetActivePlaybacks() → {Playback}

Returns every running playback on this client, local and synced.

GetActiveTracks​

This item only works when running on the server. Server
Flow:GetActiveTracks() → {SequenceTrack}

Returns every running synced playback this server started.

StopAll​

Flow:StopAll() → ()

Stops every local playback and every server track, applying restore policies. Synced playbacks on a client are left to the server.

ExportSequence​

Flow:ExportSequence(name: string) → string?

Serializes a sequence to its portable JSON export.

ImportSequence​

Flow:ImportSequence(
json: string,
nameOverride: string?
) → Instance?

Imports a JSON export as a new sequence under Flow.Sequences. Warns and returns nil if the JSON is invalid or a sequence with that name already exists.

Show raw api
{
    "functions": [
        {
            "name": "GetSequenceNames",
            "desc": "",
            "params": [],
            "returns": [
                {
                    "desc": "Names of every sequence in the place, sorted",
                    "lua_type": "{ string }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 362,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "GetSequenceInstance",
            "desc": "Returns the sequence's `Configuration` under `Flow.Sequences`, or nil if there is none.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Instance?\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 380,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "GetSequence",
            "desc": "Loads a sequence into its in-memory model. Warns and returns nil if it does not exist.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SequenceData?\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 389,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "Play",
            "desc": "Starts a local playback of a sequence, given its name, its instance, or a loaded sequence. The playback runs\non a local clock and is not synchronized with other clients; use [Flow:PlayForAll] for that.\n\nWarns and returns nil on a running server, or if the sequence cannot be found.",
            "params": [
                {
                    "name": "target",
                    "desc": "",
                    "lua_type": "string | Instance | SequenceData"
                },
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "PlayOptions?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Playback?\n"
                }
            ],
            "function_type": "method",
            "realm": [
                "Client"
            ],
            "source": {
                "line": 401,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "PlayForAll",
            "desc": "Starts a synced playback for every client and returns the [SequenceTrack] that controls it.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "PlayOptions?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SequenceTrack?\n"
                }
            ],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 436,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "PlayFor",
            "desc": "Starts a synced playback for one player and returns the [SequenceTrack] that controls it.",
            "params": [
                {
                    "name": "player",
                    "desc": "",
                    "lua_type": "Player"
                },
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "PlayOptions?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SequenceTrack?\n"
                }
            ],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 453,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "GetActivePlaybacks",
            "desc": "Returns every running playback on this client, local and synced.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ Playback }\n"
                }
            ],
            "function_type": "method",
            "realm": [
                "Client"
            ],
            "source": {
                "line": 474,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "GetActiveTracks",
            "desc": "Returns every running synced playback this server started.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ SequenceTrack }\n"
                }
            ],
            "function_type": "method",
            "realm": [
                "Server"
            ],
            "source": {
                "line": 487,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "StopAll",
            "desc": "Stops every local playback and every server track, applying restore policies. Synced playbacks on a client\nare left to the server.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 500,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "ExportSequence",
            "desc": "Serializes a sequence to its portable JSON export.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string?\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 513,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "ImportSequence",
            "desc": "Imports a JSON export as a new sequence under `Flow.Sequences`. Warns and returns nil if the JSON is\ninvalid or a sequence with that name already exists.",
            "params": [
                {
                    "name": "json",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "nameOverride",
                    "desc": "",
                    "lua_type": "string?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Instance?\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 526,
                "path": "runtime/init.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "Version",
            "desc": "The runtime's semantic version, such as `\"0.4.0\"`.",
            "lua_type": "string",
            "readonly": true,
            "source": {
                "line": 108,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "Camera",
            "desc": "The camera handoff contract. See [CameraOwnership].",
            "lua_type": "CameraOwnership",
            "readonly": true,
            "source": {
                "line": 116,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "SectionTypes",
            "desc": "",
            "lua_type": "SectionTypes",
            "readonly": true,
            "source": {
                "line": 123,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "TrackTypes",
            "desc": "",
            "lua_type": "TrackTypes",
            "readonly": true,
            "source": {
                "line": 130,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "Presets",
            "desc": "",
            "lua_type": "Presets",
            "readonly": true,
            "source": {
                "line": 137,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "Interpolation",
            "desc": "",
            "lua_type": "Interpolation",
            "readonly": true,
            "source": {
                "line": 144,
                "path": "runtime/init.luau"
            }
        }
    ],
    "types": [
        {
            "name": "SequenceData",
            "desc": "A sequence loaded into the in-memory model the evaluator consumes: its length, fps, bindings, and tracks.",
            "lua_type": "table",
            "source": {
                "line": 54,
                "path": "runtime/init.luau"
            }
        },
        {
            "name": "PlayOptions",
            "desc": "",
            "fields": [
                {
                    "name": "Bindings",
                    "lua_type": "{ [string]: Instance }?",
                    "desc": "Instances for the sequence's bindings, by binding name"
                },
                {
                    "name": "Parameters",
                    "lua_type": "{ [string]: any }?",
                    "desc": "Per-play overrides of sequence parameters"
                },
                {
                    "name": "Rate",
                    "lua_type": "number?",
                    "desc": "Playback speed multiplier; defaults to 1"
                },
                {
                    "name": "StartTime",
                    "lua_type": "number?",
                    "desc": "Sequence time to start from; defaults to 0"
                },
                {
                    "name": "Root",
                    "lua_type": "Instance?",
                    "desc": "Overrides the sequence's root for this play"
                },
                {
                    "name": "Loop",
                    "lua_type": "boolean?",
                    "desc": "Restarts from the beginning instead of completing"
                }
            ],
            "source": {
                "line": 68,
                "path": "runtime/init.luau"
            }
        }
    ],
    "name": "Flow",
    "desc": "The executor and public runtime API, injected by the plugin at `ReplicatedStorage.Flow`.\n\n```lua\nlocal Flow = require(ReplicatedStorage.Flow)\n\nlocal playback = Flow:Play(\"DoorOpen\", {\n\tBindings = { Door = hitDoor },\n\tParameters = { OpenAngle = 90 },\n})\nplayback.Completed:Wait()\n```\n\nSequences evaluate on the client. A server starts synced playback with [Flow:PlayForAll] or [Flow:PlayFor],\nwhich every client (late joiners included) derives from the same shared record.",
    "source": {
        "line": 100,
        "path": "runtime/init.luau"
    }
}