Skip to content

Replay

Load, play back, and record replay files.

Replay

Class

Implements A2Replay. For Memory Replay Buffers

Properties

Property Type Description
isPlaying boolean Should the time of this replay file automatically advance?

Methods

Method Description
setPlaybackTimeSeconds Set Playback Time Seconds
saveSegmentToFile Saves a segment of the replay to a new file. This also re-encodes the replay with the newest replay file version.
setPlaybackTimestamp Luau Set Playback Timestamp
getStartTime The timestamp of the first frame in the replay
getPlaybackTimestamp bool NextFrame(); bool PreviousFrame(); uint32 GetNearestFrameIndex(float TimeInSeconds);
getPlaybackTimeSeconds Get Playback Time Seconds
getFrameAtTimestamp Get Frame at Timestamp Copy
getFrameAtTimeSeconds Get Frame at Time Seconds Copy
getEndTime The timestamp of the last frame in the replay
getDurationSeconds The duration of the replay in seconds
getCurrentFrame Gets the ReplayFrame at the current playback time. Setting interpolate to false will only return frames that are in the original data

setPlaybackTimeSeconds

setPlaybackTimeSeconds(TimeInSeconds: number) -> nil

Set Playback Time Seconds

Parameters

Name Type
TimeInSeconds number

Returns: nil


saveSegmentToFile

saveSegmentToFile(FileName: string, SegmentStartTimeSeconds: number, SegmentEndTimeSeconds: number) -> boolean

Saves a segment of the replay to a new file. This also re-encodes the replay with the newest replay file version.

Parameters

Name Type Description
FileName string The name of the file to save. This file will be saved in the default replay directory, and the .a2replay extension will be appended if not included.
SegmentStartTimeSeconds number The time to start the segment at. This will be rounded to the nearest frame, so it doesn't have to be exact. If StartTime is before the start of the replay, it will start at the beginning of the replay.
SegmentEndTimeSeconds number The time to end the segment at. This will be rounded to the nearest frame, so it doesn't have to be exact. If EndTime is after the end of the replay, it will end at the end of the replay.

Returns: boolean


setPlaybackTimestamp

setPlaybackTimestamp(Time: DateTime) -> nil

Luau Set Playback Timestamp

Parameters

Name Type
Time DateTime

Returns: nil


getStartTime

getStartTime() -> DateTime

The timestamp of the first frame in the replay

Returns: DateTime


getPlaybackTimestamp

getPlaybackTimestamp() -> DateTime

bool NextFrame(); bool PreviousFrame(); uint32 GetNearestFrameIndex(float TimeInSeconds);

Returns: DateTime


getPlaybackTimeSeconds

getPlaybackTimeSeconds() -> number

Get Playback Time Seconds

Returns: number


getFrameAtTimestamp

getFrameAtTimestamp(Time: DateTime, bInterpolate: boolean) -> ReplayFrame

Get Frame at Timestamp Copy

Parameters

Name Type
Time DateTime
bInterpolate boolean

Returns: ReplayFrame


getFrameAtTimeSeconds

getFrameAtTimeSeconds(TimeInSeconds: number, bInterpolate: boolean) -> ReplayFrame

Get Frame at Time Seconds Copy

Parameters

Name Type
TimeInSeconds number
bInterpolate boolean

Returns: ReplayFrame


getEndTime

getEndTime() -> DateTime

The timestamp of the last frame in the replay

Returns: DateTime


getDurationSeconds

getDurationSeconds() -> number

The duration of the replay in seconds

Returns: number


getCurrentFrame

getCurrentFrame(bInterpolate: boolean) -> ReplayFrame

Gets the ReplayFrame at the current playback time. Setting interpolate to false will only return frames that are in the original data

Parameters

Name Type
bInterpolate boolean

Returns: ReplayFrame

Static functions

Method Description
unloadByIndex Unloads a replay by its index.
unloadAll Unloads all currently loaded replays.
stopRecording Stops recording the current replay file. Returns true if recording stopped, false otherwise (e.g., if Luau replay control is disabled).
startRecording Starts recording a replay file with an automatic file name. Returns true if recording started, false otherwise (e.g., if Luau replay control is disabled).
loadSubsampled Loads a replay with the given subsampling hz - DEBUG: This will be removed in the future
load Loads a replay from the given fileName inside the standard replays folder. Returns a Replay object.
listLoaded Returns a list of all replay files that have been loaded.
listAll Returns a list of all replay files in the standard replays folder.
getByIndex Gets a loaded replay by its index. Returns a Replay object or nil if the index is invalid.

unloadByIndex

Replay.unloadByIndex(Index: number) -> nil

Unloads a replay by its index.

Parameters

Name Type
Index number

Returns: nil


unloadAll

Replay.unloadAll() -> nil

Unloads all currently loaded replays.

Returns: nil


stopRecording

Replay.stopRecording() -> boolean

Stops recording the current replay file. Returns true if recording stopped, false otherwise (e.g., if Luau replay control is disabled).

Returns: boolean


startRecording

Replay.startRecording() -> boolean

Starts recording a replay file with an automatic file name. Returns true if recording started, false otherwise (e.g., if Luau replay control is disabled).

Returns: boolean


loadSubsampled

Replay.loadSubsampled(FileName: string, PlaybackSubsampleHz: number) -> Replay?

Loads a replay with the given subsampling hz - DEBUG: This will be removed in the future

Parameters

Name Type
FileName string
PlaybackSubsampleHz number

Returns: Replay?


load

Replay.load(FileName: string) -> Replay?

Loads a replay from the given fileName inside the standard replays folder. Returns a Replay object.

Parameters

Name Type
FileName string

Returns: Replay?


listLoaded

Replay.listLoaded() -> Array<string>

Returns a list of all replay files that have been loaded.

Returns: Array<string>


listAll

Replay.listAll() -> Array<string>

Returns a list of all replay files in the standard replays folder.

Returns: Array<string>


getByIndex

Replay.getByIndex(Index: number) -> Replay?

Gets a loaded replay by its index. Returns a Replay object or nil if the index is invalid.

Parameters

Name Type
Index number

Returns: Replay?