Rollback
The snapshot store half of Hindsight. Reachable via World.rollback.
Owns both the writer (capture) and the readers
(queryRay, characterPoseAt). When held
by a World, the writer fans out to every simulation actor; the reader
queries the main-thread store.
The auto-capture helpers (autoCapturePlayers,
autoCaptureCharacters,
autoCaptureCharacter) are server-only opt-ins.
Each registers a "source" of characters with the proxy; the proxy runs a
single PostSimulation hook that walks every registered source, builds one
merged CharacterPoses table, and pushes it.
Mixing helpers is safe — all sources contribute to the same snapshot per
tick.
Functions
capture
This item only works when running on the server. ServerRollback:capture(time: number,--
Server time the snapshot represents. Typically workspace:GetServerTimeNow().
) → ()
Pushes a snapshot of every character's current pose. Fans out to every
simulation actor in addition to the main-thread store. Characters whose
parts length doesn't match the configured rig are silently dropped.
Most consumers should use one of the autoCapture*
helpers instead of calling this directly.
clear
Rollback:clear() → ()Drops every retained snapshot from both the main-thread store and every simulation actor. Use on round transitions when "now" and "earlier" should not bracket the boundary.
queryRay
Rollback:queryRay(time: number,--
Server time at which to evaluate the snapshot.
length: number,--
Maximum scan distance in studs.
) → RollbackHit?--
First character whose per-part OBB the ray intersects, or nil.
Ray query against the snapshot at time. Brackets time between two
snapshots, interpolates each character's pose, runs a voxel broadphase +
AABB midphase, then OBB narrowphase per part. Returns the first hit
encountered — Hindsight does not aggregate multi-character hits in a
single query.
Returns nil if time is outside the retained snapshot window, or every
candidate was filtered, or the ray missed.
characterPoseAt
Rollback:characterPoseAt(time: number,--
Server time at which to evaluate the snapshot.
) → {[string]: CFrame}?--
Part-name → interpolated CFrame, or nil if the snapshot doesn't bracket time for this character.
Interpolated pose of a single character at a past time. Useful for debug
rendering (e.g. "where was this player when the server saw the shot?")
and for building custom hit shapes the standard queryRay doesn't cover.
autoCapturePlayers
This item only works when running on the server. ServerRollback:autoCapturePlayers() → () → ()--
Disconnect function. Call it to remove this source.
Registers a pose source that walks Players:GetPlayers() every
PostSimulation and pushes each player's .Character into the snapshot.
Skips dead, parentless, or rig-incompatible characters.
The first auto-capture registration on a world starts a shared
PostSimulation hook; the last disconnect stops it. Server-only — asserts
on the client.
local stop = world.rollback:autoCapturePlayers()
-- later:
stop()
autoCaptureCharacters
This item only works when running on the server. ServerRollback:autoCaptureCharacters() → () → ()--
Disconnect function. Call it to remove this source.
Registers a pose source that walks folder:GetChildren() every
PostSimulation. Use this when both players and NPCs live under one
container — typically workspace.Characters — so a single registration
covers everyone. Skips non-Model children, dead Humanoids, and
rig-incompatible characters.
Server-only.
autoCaptureCharacter
This item only works when running on the server. ServerRollback:autoCaptureCharacter() → () → ()--
Disconnect function. Call it to remove this source.
Registers a pose source for one specific Model. Useful for boss enemies,
scripted NPCs, or any character that lives outside the main characters
container. Stops contributing automatically once the character is dead or
reparented to nil, but the source itself stays registered until the
disconnect runs.
Server-only.