The code above behaves as how the Parent property is locked using :Destroy() method.
Perhaps, another temporary method would be to record the Instance somewhere else with its properties serialized in a script and when the Instance gets removed from the Workspace, the script registered the serialization would use the ChildRemoved event and re-insert that Instance. Like as follows:
local part = workspace.Part
local serialization = {
[1] = part.CFrame --etc
}
workspace.ChildRemoved:Connect(function(removedChild)
for i, v in ipairs(serialization) do
local clone = removedChild:Clone()
clone.CFrame = v
end
end)
local Instance = urpartpath
local clonedinstance = Instance:Clone()
local Instanceparent = Instance.Parent
Instance:GetPropertyChangedSignal("Parent"):Connect(function()
if instance.Parent ~= game.Workspace then
task.wait()
Instance.Parent = workspace
end
end) --ratiusrat's code.
Instanceparent.ChildRemoved:Connect(function()
if not Instance ~= nil then
clonedinstance.Parent = Instanceparent
Instance = clonedinstance
clonedinstance = Instance:Clone()
end
end)
It’s not gonna work properly but it should give you an idea