ChangeHistoryService:SetWaypoint to save script changes

As a Roblox developer, it is currently impossible to use ChangeHistoryService to save script changes

Right now whenever I make a change with a script I have to reopen studio because I cannot undo the change
This is pretty annoying especially since studio has been opening up ultra slowly in the recent 3 months

2 Likes

I don’t want ChangeHistoryService to manage script changes. Changes to the game world and changes to code should be kept separate because they’re different working environments. The expected behavior is for undo to undo some change made in your immediate environment.

Instead, there should be some separate system for managing history per script.

8 Likes

I don’t think Roblox should insert automatic waypoints into the ChangeHistoryService list, I think whatever they do now is perfect for that

But if we use SetWaypoint explicitly, I think it is desired (at least I desire) to insert a waypoint into the ChangeHistoryService list, so that I can easily undo/redo

What would you do instead though? A separate shortcut to undo in scripts? What I use it for is, not to make changes to just one script, but hundreds, so the solution would need to be easily scalable to more than one script

You should describe your use cases so engineers can find a properly fitting solution.

What…? Ctrl+Z undos changes to script source. You don’t need to restart Studio to do this.

If you mean you can’t undo changes made by scripts to the game, that gets undone when you stop the game and return from play solo.

2 Likes

Changes made by scripts via command bar/plugin is the topic of discussion

Plugins can save changes with ChangeHistoryService. It’s up to the developer to implement this properly. Some plugins do like the derivatives of CmdUtl, while others don’t. If plugins you use are in the latter category, that’s a plugin problem and not a Roblox one. Tell the plugin creator to fix their plugin, or locally modify the plugin yourself.

The command bar can use ChangeHistoryService as well. Insert a part into Workspace and then run:

workspace.Part.Color = Color3.new(1,0,0) game:GetService("ChangeHistoryService"):SetWaypoint("Blah2")

You will be able to undo/redo the color of the part.

1 Like

ChangeHistoryService:SetWaypoint to save script changes

I know ChangeHistoryService:SetWaypoint exists and I know you can use it
But it doesn’t work for script changes

What are “script changes”? Scripts can’t run in either of these cases

1 Like

changes to script source via plugin

After a year we still have nothing to be seen for this feature.

I would suggest that we have :SetScriptWaypoint(script, string id) to separate it from game changes?

I use plugins to overwrite source code sometimes and I would definitely appreciate this.

1 Like

This is difficult to fix, we can’t simply turn on the ChangeHistoryService for the .Source property, which is why it has gone unfixed for so long.

What the .Source property returns changes every single time you type a character in a script, but the ChangeHistoryService can’t afford to record all the contents of a large script x however many characters you type in it during a session. The script editor doesn’t have this problem because it has smarter text-editing specific undo handling.

If you want a workaround for script changes which happen all at once, you can delete the old script, and create a new script with the modified source rather than editing the existing script’s source. That way the changes will be picked up (Note: You will have to set the .Source property before you parent the new script to the hierarchy for this to work).

3 Likes