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)

2 comments
So, I should send the object itself into the array, then use something to get the name of that object and send it back into the game?
Nevermind. I just need a string that has the object's name, then I need to use that string to find the object and retrieve it!