ChangeHistoryService does not undo or redo changes made to TextLabel.Text, TextBox.Text or TextButton.Text

Hey, I am writing a plugin and have found that ChangeHistoryService does not undo or redo changes made to TextBox.Text, TextLabel.Text, or TextButton.Text by a plugin or code (This works fine if it is changed manually via properties).

This is occurring inside of a DockWidgetPluginGui inside of Roblox Studio Version 0.421.0.385673(64bit)

Here is a demonstration:
In this video I change a value from 0.299 to 1 and undo then redo several times - this can be seen working as intended on the character (the blue ball) but there is no change made to the TextBox (lower right).

I’ve set a waypoint before and after making changes in the TextBox.LostFocus event. Here’s the code for a local plugin to repro this: hastebin (you’ll need to add your own screengui and textbox.)

2 Likes

Are the instances being changed have Archivable marked as false?

Both the instance being changed and its ancestry are all marked as Archivable true in my plugin.

Not quite on-topic, but many thanks to whomever made ChangeHistoryService ignore non-Archivable instances. Plugins can now created complex objects and visualizations that are ignored by undo/redo which is huge!

2 Likes

Ah sorry, I just realized that you’re trying to do. Unfortunately, the ChangeHistoryService only tracks changes in the workspace, so what you’re seeing does make sense. What the plugin needs to do is use the waypoints to tag changes it makes to the workspace and then set up a listener to handle the undo and redo events when those plugin events are encountered.

Take a look at the onRedo and onUndo events.

4 Likes

Also, that was me :smiley: Hopefully it’s been very helpful.

5 Likes

also some “Sound” properties like EmitterSize and MaxDistance also dont undo with CTRL+Z

I see, that makes sense, thank you for clearing that up!