Reference API Roblox

Engine API

Website

Related

Reference API Roblox

ChangeHistoryService

Must be used by plugins to communicate to Studio how to undo and redo the changes which they make to the experience.

This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is a service. It is a singleton that may be acquired with GetService.
Tags: [NotCreatable, Service]

Member index 14

HistoryMember
583FinishRecording(identifier: string, operation: FinishRecordingOperation, finalOptions: Dictionary?): null
462GetCanRedo(): Tuple
462GetCanUndo(): Tuple
583IsRecordingInProgress(identifier: string?): bool
573Redo(): null
573ResetWaypoints(): null
573SetEnabled(state: bool): null
573SetWaypoint(name: string): null
583TryBeginRecording(name: string, displayName: string?): string?
573Undo(): null
583OnRecordingFinished(name: string, displayName: string?, identifier: string?, operationn: FinishRecordingOperation, finalOptions: Dictionary?)
583OnRecordingStarted(name: string, displayName: string?)
462OnRedo(waypoint: string)
462OnUndo(waypoint: string)
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Description

Plugin developers must use ChangeHistoryService to tell Studio how to undo and redo changes that their plugins make to experiences by recording. Before making changes, a plugin calls ChangeHistoryService:TryBeginRecording(), remembering the identifier it assigns, then after making changes, the Plugin calls ChangeHistoryService:FinishRecording() to complete the recording.

Plugins may also programmatically invoke an undo or redo through ChangeHistoryService:Undo() or ChangeHistoryService:Redo().

ChangeHistoryService is not enabled at runtime, so calling its methods in a running experience has no effect.

History 43

Members 14

FinishRecording

Parameters (3)
identifierstring
operationFinishRecordingOperation
finalOptionsDictionary?
Returns (1)
null

History 1

GetCanRedo

Parameters (0)
No parameters.
Returns (1)
Tuple

Returns whether there are actions that can be redone, and, if there are, returns the last of them.

History 4

GetCanUndo

Parameters (0)
No parameters.
Returns (1)
Tuple

Returns whether there are actions that can be undone, and, if there are, returns the last of them.

History 4

IsRecordingInProgress

Parameters (1)
identifierstring?
Returns (1)
bool

History 1

OnRecordingFinished

Parameters (5)
namestring
displayNamestring?
identifierstring?
operationnFinishRecordingOperation
finalOptionsDictionary?

History 1

OnRecordingStarted

Parameters (2)
namestring
displayNamestring?

History 1

OnRedo

Parameters (1)
waypointstring

Fired when the user reverses the undo command. Waypoint describes the type action that has been redone.

History 2

OnUndo

Parameters (1)
waypointstring

Fired when the user undoes an action in studio. Waypoint describes the type action that has been undone.

History 2

Redo

Parameters (0)
No parameters.
Returns (1)
null

Executes the last action that was undone.

History 5

  • 573 Change ReturnType of Redo from void to null
  • 462 Change ThreadSafety of Redo from to Unsafe
  • 151 Change Security of Redo from security1 to PluginSecurity
  • 150 Change Security of Redo from LocalUserSecurity to security1
  • 47 Add Redo

ResetWaypoints

Parameters (0)
No parameters.
Returns (1)
null

Clears the history, causing all undo/redo waypoints to be removed.

History 5

SetEnabled

Parameters (1)
statebool
Returns (1)
null

Sets whether or not the ChangeHistoryService is enabled. When set to false, the undo/redo list is cleared, and does not repopulate. When set to true again, the original list is not restored, but further operations append to the list once more

History 5

SetWaypoint

Parameters (1)
namestring
Returns (1)
null

This method will be deprecated soon in favor of TryBeginRecording().

ChangeHistoryService tracks plugin history as a stream of property changes. SetWaypoint() creates a cut in that stream of property changes so that the undo and redo actions know where to stop.

By convention, user-invoked actions in Studio must call SetWaypoint() after completing their set of changes to the experience. Calling it before a set of changes may clean up another misbehaving plugin which failed to set a waypoint, but it's a poor reason to justify such usage in your own plugin.

History 5

TryBeginRecording

Parameters (2)
namestring
displayNamestring?
Returns (1)
string?

This method begins a recording to track changes to the data model. You must call it prior to making changes to avoid future warnings or errors.

When the recording is completed, you call FinishRecording() with the returned recording identifier to complete the recording and update the undo/redo stack.

This method will return nil if it fails to begin a recording. Recordings fail if the plugin already has a recording in progress, or if the user is in Run or Play mode.

You may use IsRecordingInProgress() to check the recording status of the plugin.

History 1

Undo

Parameters (0)
No parameters.
Returns (1)
null

Undos the last action taken, for which there exists a waypoint.

History 5

  • 573 Change ReturnType of Undo from void to null
  • 462 Change ThreadSafety of Undo from to Unsafe
  • 151 Change Security of Undo from security1 to PluginSecurity
  • 150 Change Security of Undo from LocalUserSecurity to security1
  • 47 Add Undo

Settings