Hello, I am looking to make an undo button for my game. In my game, you can customize a part any way you like. I want to make an undo system so the player can undo the changes they have made to the part. In the game, you can change the colour of the part, change the material of the part, and add children such as Sparkles, Fire, etc. Would it be possible to make a script to undo these changes?
Thanks for your help! 
There’s no way that I know of to undo changes (other than ChangeHistoryService but that only works in plugins) but you could just store the previous states in a variable and revert the value when you need to.
local History = {}
--The user updates the part’s name to “Hello”, so we store the previous name in the history table
History[#History+1] = {“Name”,part.Name}
part.Name = “Hello”
--Revert the most recent change when needed:
local h = History[#History]
part[h[1]] = part[h[2]]
History[#History]] = nil
Not sure if that’s the cleanest or most efficient solution, but it should work
I would make a table that stores every single action.
Then in your function that places the objects that you described make it add in any necessary info into the table to undo the action (ex: actionname, actionposition, actiondirectory)
Then using userinputservice or contextactionservice you can sense when a player presses the keybind to undo, when this happens check the last object that was added to the table and using that info that we put into the table undo the action, of course remove that segment from the table after undoing.