benjacara2
(benjacara2)
1
im trying to set a UI frame to nil for storage at a NIL parent
example:
local getPartBack = script.Event
local part = script.Frame
part.Parent = nil
wait(5)
getPartBack:Fire()
getPartBack.Event:Connect(function()
part.Parent = script.Parent.Parent.Workspace
end)
will the part be deleted when parenting to NIL or will the script still have a reference to the object to parent it back into reality?
Parts are not deleted when their parent is set to nil so if the reference exists in scope it’d be fine
1 Like
In fact, you should never use assigning an object’s parent as nil to try and “destroy” an item as it does not guarantee that the item is destroyed
see the following reference page
https://create.roblox.com/docs/reference/engine/classes/Instance#Destroy
1 Like
system
(system)
Closed
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.