Hello, I would like to know how to use and what can I do with this service? I have tried some things but I am not entirely clear what its functionality and use is, someone would be so kind to explain it to me
local ChangeHistoryService = game:GetService("ChangeHistoryService")
-- Do something...
It’s something for Plugins, it’s basically what it implies. It changes the history of actions a developer has made. It cannot be used for gameplay however if that’s what you were thinking. Some other methods like SetWaypoint() too but if you’re looking to make a plugin, it may come in handy, depends on use case.
Is it like something like doing a commit with git? save a point and if I make a mistake in the future, can I go back to that backup point and recover it?
Yes, it’s a much weaker and simpler version of it but you’d expect the same result essentially.
Although I don’t believe, I could be wrong but I don’t think undos and redos are saved to be used outside of a studio session, unlike in git so it would be something you could only do per session. You can see if I’m wrong by testing it in a plugin for yourself.
But it’s use case is typically what you’d expect from any ide or even in here. If you were to type something and hit a “Redo” or “Undo” command which for me is ctrl + z to undo. That’s the kind of behavior you could modify using a plugin.
no it’s a undo history, it’ll go to the previous point when you press ctrl + z and go to the one you just were on when you press ctrl + y
waypoint 3 → ctrl + z → waypoint 2 → ctrl + y → waypoint 3
aka a much simpler version of using git commits. In git you’d see something along the lines of a few lines in the console that’ll undo and redo a commit, as well as a reset method. With ChangeHistoryService you may not need a console but it will have the same effect, just kinda weaker cause well, roblox doesn’t need anything beyond that currently.
Thanks a lot for the clarification guys! It is very helpful, I personally know how to use git and the truth is I did not expect to see something like this in roblox, I am going to see it and check how it goes…
If I create a point with SetWaypoint then (in the future) how can I access this restore point?
I would suggest looking at the developer wiki
It does handle a lot differently than what you’ll be used to. I personally don’t use it but I get the idea of it. From what I can understand, there’s OnUndo and OnRedo methods with a waypoint callback attached to it. That would be a good place to start looking
Thanks for your help guys !!
No problem! Also would look at the GetCanRedo and GetCanUndo methods as it may or may not return the waypoint for you. Not sure, would fact check everything I say on that but regardless you should be able to revert successfully, nothing playing around with plugins can’t solve