Skip to main content

Snapshot

Serializes the visible state of a part or model into a compact buffer and rebuilds it as an anchored proxy. Every BasePart descendant is kept with its offset from the root, size, appearance, surfaces, decals and textures, meshes, PBR surface appearance, attachments and the effects on them (sounds, particle emitters, beams, trails, fire, smoke, sparkles, lights). Models with a Humanoid also keep clothing and body colours so rigs and NPCs look right on playback.

MeshPart meshes come back as real MeshParts built through AssetService:CreateMeshPartAsync (call prefetch first; it yields), so clothing, body colours and surface appearance render exactly as recorded. Without a prefetched mesh a Part carrying a scaled SpecialMesh stands in. Joints (Motor6D, Weld, AnimationConstraint and RigidConstraint) are kept so rebuilt rigs still animate. Constraint joints come back as Motor6D and Weld built from their attachment offsets: the Animator drives those kinematically, so playback also works in Studio edit mode where physics (and therefore AnimationConstraint) does not run.

UnionOperation geometry cannot be read back at runtime. Unions are stored by key (their full name when recorded) and resolved through links or the same path on playback; unresolved unions fall back to a plain Part.

Every snapshot also carries the source key of the instance it was taken from. Linking that key to a prefab (for example under ReplicatedStorage) makes playback clone the prefab instead of rebuilding from the snapshot, which is the way to bring back models whose geometry cannot be serialized.

Functions​

rootOf​

Snapshot.rootOf(inst: Instance) → BasePart?

The part whose CFrame stands for an instance: the part itself, a model's PrimaryPart, or its first part. Shared with the Recorder so recorded transforms and snapshot offsets always refer to the same part.

segment​

Snapshot.segment(inst: Instance) → string

Path segment for an instance: its name, followed by #n when other siblings share that name (n counts same-named siblings in child order). Names alone are ambiguous inside many models (several Wheels, several unions called Union), and runtime scripts cannot read UniqueId.

child​

Snapshot.child(
parent: Instance,
segment: string
) → Instance?

Resolves one segment under parent: an exact name first (names may contain #), then the Name#n form.

pathWithin​

Snapshot.pathWithin(
inst: Instance,
root: Instance
) → string?

Segments of inst below root, joined with /. Nil when inst is not inside root; empty when they are the same instance.

resolve​

Snapshot.resolve(
root: Instance,
path: string
) → Instance?

Follows a / path from root.

pathOf​

Snapshot.pathOf(inst: Instance) → string

Unique full path from the DataModel, dotted like GetFullName but with #n on ambiguous segments.

instanceAt​

Snapshot.instanceAt(key: string) → Instance?

Walks a dotted path (see pathOf) from the DataModel. Returns nil when any segment is missing.

prefetch​

Snapshot.prefetch(data: buffer) → ()

Creates a MeshPart template for every mesh id a snapshot uses. Yields on first use of each id; later builds are synchronous. Ids that fail to load fall back to a SpecialMesh at build time.

resolveUnion​

Snapshot.resolveUnion(key: string) → UnionOperation?

Finds the UnionOperation a key refers to: a manual link first, then the instance at the same path the union had when recorded.

keys​

Snapshot.keys(data: buffer) → Keys

Reads the source key and the union keys a snapshot depends on without rebuilding it.

capture​

Snapshot.capture(
inst: Instance,
exclude: ((Instance) → boolean)?
) → buffer?

Captures inst relative to its root part. Returns nil when there is no geometry to capture. Descendants for which exclude returns true are left out along with everything inside them.

build​

Snapshot.build(data: buffer) → Instance

Rebuilds a snapshot as an anchored, non-colliding Part or Model whose pivot matches the original root. A linked prefab is cloned instead, with its pivot moved to the part at the recorded root's path (or name) so recorded transforms land where the original did.

Show raw api
{
    "functions": [
        {
            "name": "rootOf",
            "desc": "The part whose CFrame stands for an instance: the part itself, a model's\nPrimaryPart, or its first part. Shared with the Recorder so recorded\ntransforms and snapshot offsets always refer to the same part.",
            "params": [
                {
                    "name": "inst",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "BasePart?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 69,
                "path": "src/Flashback/Snapshot.luau"
            }
        },
        {
            "name": "segment",
            "desc": "Path segment for an instance: its name, followed by `#n` when other\nsiblings share that name (n counts same-named siblings in child order).\nNames alone are ambiguous inside many models (several `Wheel`s, several\nunions called `Union`), and runtime scripts cannot read `UniqueId`.",
            "params": [
                {
                    "name": "inst",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 86,
                "path": "src/Flashback/Snapshot.luau"
            }
        },
        {
            "name": "child",
            "desc": "Resolves one segment under `parent`: an exact name first (names may\ncontain `#`), then the `Name#n` form.",
            "params": [
                {
                    "name": "parent",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "segment",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Instance?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 108,
                "path": "src/Flashback/Snapshot.luau"
            }
        },
        {
            "name": "pathWithin",
            "desc": "Segments of `inst` below `root`, joined with `/`. Nil when `inst` is not\ninside `root`; empty when they are the same instance.",
            "params": [
                {
                    "name": "inst",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "root",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 135,
                "path": "src/Flashback/Snapshot.luau"
            }
        },
        {
            "name": "resolve",
            "desc": "Follows a `/` path from `root`.",
            "params": [
                {
                    "name": "root",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "path",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Instance?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 152,
                "path": "src/Flashback/Snapshot.luau"
            }
        },
        {
            "name": "pathOf",
            "desc": "Unique full path from the DataModel, dotted like `GetFullName` but with\n`#n` on ambiguous segments.",
            "params": [
                {
                    "name": "inst",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 167,
                "path": "src/Flashback/Snapshot.luau"
            }
        },
        {
            "name": "instanceAt",
            "desc": "Walks a dotted path (see `pathOf`) from the DataModel. Returns nil when\nany segment is missing.",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Instance?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 443,
                "path": "src/Flashback/Snapshot.luau"
            }
        },
        {
            "name": "prefetch",
            "desc": "Creates a MeshPart template for every mesh id a snapshot uses. Yields on\nfirst use of each id; later builds are synchronous. Ids that fail to load\nfall back to a SpecialMesh at build time.",
            "params": [
                {
                    "name": "data",
                    "desc": "",
                    "lua_type": "buffer"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 469,
                "path": "src/Flashback/Snapshot.luau"
            }
        },
        {
            "name": "resolveUnion",
            "desc": "Finds the UnionOperation a key refers to: a manual link first, then the\ninstance at the same path the union had when recorded.",
            "params": [
                {
                    "name": "key",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "UnionOperation?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 488,
                "path": "src/Flashback/Snapshot.luau"
            }
        },
        {
            "name": "keys",
            "desc": "Reads the source key and the union keys a snapshot depends on without\nrebuilding it.",
            "params": [
                {
                    "name": "data",
                    "desc": "",
                    "lua_type": "buffer"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Keys\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 498,
                "path": "src/Flashback/Snapshot.luau"
            }
        },
        {
            "name": "capture",
            "desc": "Captures `inst` relative to its root part. Returns nil when there is no\ngeometry to capture. Descendants for which `exclude` returns true are\nleft out along with everything inside them.",
            "params": [
                {
                    "name": "inst",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "exclude",
                    "desc": "",
                    "lua_type": "((Instance) -> boolean)?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "buffer?\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 908,
                "path": "src/Flashback/Snapshot.luau"
            }
        },
        {
            "name": "build",
            "desc": "Rebuilds a snapshot as an anchored, non-colliding Part or Model whose\npivot matches the original root. A linked prefab is cloned instead, with\nits pivot moved to the part at the recorded root's path (or name) so\nrecorded transforms land where the original did.",
            "params": [
                {
                    "name": "data",
                    "desc": "",
                    "lua_type": "buffer"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Instance\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 1011,
                "path": "src/Flashback/Snapshot.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Snapshot",
    "desc": "Serializes the visible state of a part or model into a compact buffer and\nrebuilds it as an anchored proxy. Every BasePart descendant is kept with\nits offset from the root, size, appearance, surfaces, decals and textures,\nmeshes, PBR surface appearance, attachments and the effects on them\n(sounds, particle emitters, beams, trails, fire, smoke, sparkles, lights). Models with a Humanoid also keep\nclothing and body colours so rigs and NPCs look right on playback.\n\nMeshPart meshes come back as real MeshParts built through\n`AssetService:CreateMeshPartAsync` (call `prefetch` first; it yields), so\nclothing, body colours and surface appearance render exactly as recorded.\nWithout a prefetched mesh a Part carrying a scaled SpecialMesh stands in.\nJoints (Motor6D, Weld, AnimationConstraint and RigidConstraint) are kept\nso rebuilt rigs still animate. Constraint joints come back as Motor6D and\nWeld built from their attachment offsets: the Animator drives those\nkinematically, so playback also works in Studio edit mode where physics\n(and therefore AnimationConstraint) does not run.\n\nUnionOperation geometry cannot be read back at runtime. Unions are stored\nby key (their full name when recorded) and resolved through `links` or the\nsame path on playback; unresolved unions fall back to a plain Part.\n\nEvery snapshot also carries the source key of the instance it was taken\nfrom. Linking that key to a prefab (for example under ReplicatedStorage)\nmakes playback clone the prefab instead of rebuilding from the snapshot,\nwhich is the way to bring back models whose geometry cannot be serialized.",
    "source": {
        "line": 30,
        "path": "src/Flashback/Snapshot.luau"
    }
}