Use history recording and don't do anything permanent (#915)

This commit is contained in:
boatbomber 2024-05-30 12:28:58 -07:00 • committed by GitHub
parent 3d4e387d35
commit 62f4a1f3c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 59 additions and 17 deletions

View file

@ -112,9 +112,12 @@ end
function InstanceMap:destroyInstance(instance)
local id = self.fromInstances[instance]
local descendants = instance:GetDescendants()
instance:Destroy()
-- Because the user might want to Undo this change, we cannot use Destroy
-- since that locks that parent and prevents ChangeHistoryService from
-- ever bringing it back. Instead, we parent to nil.
instance.Parent = nil
-- After the instance is successfully destroyed,
-- we can remove all the id mappings