Hello i am making a undo button for my game, where u can undo parts that you create, this all happens on the client, i already got a previous part but i want to get the previous part to the previous one
Code:
PartButton.MouseButton1Click:Connect(function()
local Part = game.ReplicatedStorage.NewPart:Clone()
Part.Parent = workspace.Parts
-- Set the previous part
PreviousPart = Part
end)
Undo.MouseButton1Click:Connect(function()
if PreviousPart ~= nil then
PreviousPart:Destroy()
PreviousPart = nil
end
end)

4 comments
You could save all the parts interacted with in a table as they are acted upon. This way, they'll be in an "ordered list" of sorts, and you can track them
Im trying that, thank you!
You can use the changed event and once change detected, you can list it.
How is it going to change?