So I have this script in a model, but I can't get the object back even by using something relative to its name!
Here's what I mean (My Code):
for i,v in pairs(script.Parent.ObjectStorage:GetChildren()) do if v.ClassName ~= 'Folder' then local ObjectName = Instance.new('StringValue', script.Parent) ObjectName.Name = v.Name end end Objects = { Object1 = 'River' } ObjectStorage = {} function GetExistingObject() for i,v in pairs(script.Parent.Objects:GetChildren()) do if v.ClassName ~= 'Folder' then return v end end end script.Parent.Btn1.Touched:Connect(function() local River = GetExistingObject() ObjectStorage[River.Name] = RIver:Clone() River:Destroy() end) script.Parent.Btn2.Touched:Connect(function() local River = Objects.Object1 ObjectStorage[River].Parent = script.Parent.ObjectStorage end)
Instead of doing :Destroy have you tried re-parenting it back into the folder so then it isn't permanently deleted from the game? That should work.
Here's what I mean:
Object = 'Platform' Storage = {} Debounce = false script.Parent.StoreGrab.Touched:Connect(function() if not Debounce then Debounce = true if script.Parent:FindFirstChild(Object) then Storage[Object] = script.Parent.Platform:Clone() script.Parent.Platform:Destroy() elseif not script.Parent:FindFirstChild(Object) then Storage[Object].Parent = script.Parent end wait(1.5) Debounce = false end)