Skip to main content

Recorder

Server-side recorder. Tracks tagged instances and writes transforms, spawn/despawn, watched properties, animations, gameplay events and custom channels into a replay buffer.

Transforms are delta-compressed: after a full sample, each moving tick costs a few bytes of quantized position delta plus a yaw delta for upright entities. Parts jointed to a tracked ancestor (character limbs, welded attachments) are not written at all; the playback rig's own joints and animations move them.

Functions​

parseWatch​

Recorder.parseWatch(list: string) → {[string]: {string}}

Parses a watch list such as BasePart.Color,Humanoid.Health into the class -> properties table watchProperties uses.

watchProperties​

Recorder.watchProperties(
self: Recorder,
className: string,
props: {string}
) → ()

Records the named properties of every tracked instance that IsA className. Initial values are written on spawn and changes are written each tick. Limbs and other jointed sub-parts are skipped; their look comes from the playback rig.

registerChannel​

Recorder.registerChannel(
self: Recorder,
name: string,
writer: ChannelWriter
) → ()

Registers a per-tick binary writer. The player must register a reader for the same channel name.

event​

Recorder.event(
self: Recorder,
name: string,
payload: {[string]: any}?
) → ()

Queues a discrete gameplay event. The payload is JSON encoded and delivered to player-side handlers registered with the same name.

custom​

Recorder.custom(
self: Recorder,
channel: string,
data: buffer
) → ()

Queues an ad-hoc binary payload on a channel.

track​

Recorder.track(
self: Recorder,
inst: Instance
) → ()

Explicitly tracks an instance without tagging it.

_recheckJoints​

Recorder._recheckJoints(
self: Recorder,
e: Entity
) → ()

Gives a limb its own entity once nothing holds it to the rig any more (joints broken on death, a weld destroyed), so its fall is recorded.

_spawn​

Recorder._spawn(
self: Recorder,
e: Entity
) → ()

Writes SPAWN and starts following an entity: props, snapshot, animations, tools carried inside it and sounds played on it.

_capture​

Recorder._capture(
self: Recorder,
e: Entity
) → buffer?

Snapshot of an entity without the geometry of entities carried inside it (an equipped tool), which have snapshots of their own.

_pollTracks​

Recorder._pollTracks(
self: Recorder,
e: Entity
) → ()

Tracks are polled each tick instead of trusting Stopped, which does not fire reliably for tracks replicated from a client, so a stop lands within one tick of the track going idle.

_flushSnapshot​

Recorder._flushSnapshot(
self: Recorder,
e: Entity
) → ()

Writes the entity's geometry once. The capture taken at spawn is held back while descendants keep arriving (a character still loading limbs and accessories) and replaced by a fresh capture once the entity has been quiet for a second, so a replay carries one snapshot per entity instead of one per arrival. Pending captures are flushed on untrack, stop and finalize; the player keeps the last snapshot it decodes.

_descendantProps​

Recorder._descendantProps(
_self: Recorder,
e: Entity,
) → {string}?

Properties the entity's watch list names for an instance: the union of every listed class it IsA (so BasePart.Color and Part.Shape both apply to a Part). Nil when nothing matches.

_writeProp​

Recorder._writeProp(
self: Recorder,
e: Entity,
inst: Instance,
name: string,
key: string,
v: any,
force: boolean
) → ()

Writes one PROP op when the value changed since the last tick. On the spawn tick (force) values the snapshot already carries are only remembered, not written.

_writeProps​

Recorder._writeProps(
self: Recorder,
e: Entity,
force: boolean
) → ()

Watched properties of the entity and its descendants, its attributes (written as @Name) and, for models, the scale relative to spawn (written as Scale).

_writeTick​

Recorder._writeTick(self: Recorder) → ()

Emits the tick marker lazily so idle ticks cost nothing.

snapshot​

Recorder.snapshot(self: Recorder) → ()

Writes one tick. Called automatically while running, and callable directly for deterministic stepping.

step​

Recorder.step(
self: Recorder,
dt: number
) → ()

Advances the recorder clock by dt seconds, emitting as many ticks as elapsed.

stop​

Recorder.stop(self: Recorder) → buffer

Stops recording and returns the finished replay buffer.

finalize​

Recorder.finalize(self: Recorder) → buffer

Assembles header, string table, keyframe index and op stream into a buffer. Safe to call while running to get a partial replay.

byteCount​

Recorder.byteCount(self: Recorder) → number

Approximate size in bytes of the replay if finalized now.

Show raw api
{
    "functions": [
        {
            "name": "parseWatch",
            "desc": "Parses a watch list such as `BasePart.Color,Humanoid.Health` into the\nclass -> properties table `watchProperties` uses.",
            "params": [
                {
                    "name": "list",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [string]: { string } }\r\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 196,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "watchProperties",
            "desc": "Records the named properties of every tracked instance that IsA className.\nInitial values are written on spawn and changes are written each tick.\nLimbs and other jointed sub-parts are skipped; their look comes from the\nplayback rig.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "className",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "props",
                    "desc": "",
                    "lua_type": "{ string }"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 250,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "registerChannel",
            "desc": "Registers a per-tick binary writer. The player must register a reader for\nthe same channel name.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "writer",
                    "desc": "",
                    "lua_type": "ChannelWriter"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 259,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "event",
            "desc": "Queues a discrete gameplay event. The payload is JSON encoded and delivered\nto player-side handlers registered with the same name.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "payload",
                    "desc": "",
                    "lua_type": "{ [string]: any }?"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 268,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "custom",
            "desc": "Queues an ad-hoc binary payload on a channel.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "channel",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "data",
                    "desc": "",
                    "lua_type": "buffer"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 279,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "track",
            "desc": "Explicitly tracks an instance without tagging it.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "inst",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 290,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "_recheckJoints",
            "desc": "Gives a limb its own entity once nothing holds it to the rig any more\n(joints broken on death, a weld destroyed), so its fall is recorded.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "e",
                    "desc": "",
                    "lua_type": "Entity"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 428,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "_spawn",
            "desc": "Writes SPAWN and starts following an entity: props, snapshot, animations,\ntools carried inside it and sounds played on it.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "e",
                    "desc": "",
                    "lua_type": "Entity"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 449,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "_capture",
            "desc": "Snapshot of an entity without the geometry of entities carried inside it\n(an equipped tool), which have snapshots of their own.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "e",
                    "desc": "",
                    "lua_type": "Entity"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "buffer?\r\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 529,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "_pollTracks",
            "desc": "Tracks are polled each tick instead of trusting `Stopped`, which does\nnot fire reliably for tracks replicated from a client, so a stop lands\nwithin one tick of the track going idle.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "e",
                    "desc": "",
                    "lua_type": "Entity"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 604,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "_flushSnapshot",
            "desc": "Writes the entity's geometry once. The capture taken at spawn is held\nback while descendants keep arriving (a character still loading limbs\nand accessories) and replaced by a fresh capture once the entity has\nbeen quiet for a second, so a replay carries one snapshot per entity\ninstead of one per arrival. Pending captures are flushed on untrack,\nstop and finalize; the player keeps the last snapshot it decodes.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "e",
                    "desc": "",
                    "lua_type": "Entity"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 626,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "_descendantProps",
            "desc": "Properties the entity's watch list names for an instance: the union of\nevery listed class it IsA (so `BasePart.Color` and `Part.Shape` both\napply to a Part). Nil when nothing matches.",
            "params": [
                {
                    "name": "_self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "e",
                    "desc": "",
                    "lua_type": "Entity"
                },
                {
                    "name": "d",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ string }?\r\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 649,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "_writeProp",
            "desc": "Writes one PROP op when the value changed since the last tick. On the\nspawn tick (`force`) values the snapshot already carries are only\nremembered, not written.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "e",
                    "desc": "",
                    "lua_type": "Entity"
                },
                {
                    "name": "inst",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "v",
                    "desc": "",
                    "lua_type": "any"
                },
                {
                    "name": "force",
                    "desc": "",
                    "lua_type": "boolean\r\n"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 682,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "_writeProps",
            "desc": "Watched properties of the entity and its descendants, its attributes\n(written as `@Name`) and, for models, the scale relative to spawn\n(written as `Scale`).",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "e",
                    "desc": "",
                    "lua_type": "Entity"
                },
                {
                    "name": "force",
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 739,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "_writeTick",
            "desc": "Emits the tick marker lazily so idle ticks cost nothing.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 792,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "snapshot",
            "desc": "Writes one tick. Called automatically while running, and callable directly\nfor deterministic stepping.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 926,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "step",
            "desc": "Advances the recorder clock by dt seconds, emitting as many ticks as elapsed.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                },
                {
                    "name": "dt",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 985,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "stop",
            "desc": "Stops recording and returns the finished replay buffer.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "buffer\r\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1067,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "finalize",
            "desc": "Assembles header, string table, keyframe index and op stream into a buffer.\nSafe to call while running to get a partial replay.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "buffer\r\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1086,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        },
        {
            "name": "byteCount",
            "desc": "Approximate size in bytes of the replay if finalized now.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "Recorder"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number\r\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1122,
                "path": "packages/src/Flashback/Recorder.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Recorder",
    "desc": "Server-side recorder. Tracks tagged instances and writes transforms,\nspawn/despawn, watched properties, animations, gameplay events and custom\nchannels into a replay buffer.\n\nTransforms are delta-compressed: after a full sample, each moving tick costs\na few bytes of quantized position delta plus a yaw delta for upright\nentities. Parts jointed to a tracked ancestor (character limbs, welded\nattachments) are not written at all; the playback rig's own joints and\nanimations move them.",
    "source": {
        "line": 14,
        "path": "packages/src/Flashback/Recorder.luau"
    }
}