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
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
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
Resolves one segment under parent: an exact name first (names may
contain #), then the Name#n form.
pathWithin
Segments of inst below root, joined with /. Nil when inst is not
inside root; empty when they are the same instance.
resolve
Follows a / path from root.
pathOf
Unique full path from the DataModel, dotted like GetFullName but with
#n on ambiguous segments.
instanceAt
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
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) → KeysReads the source key and the union keys a snapshot depends on without rebuilding it.
capture
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
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.