#Confused about the use of a empty table

1 messages · Page 1 of 1 (latest)

steep solar
#

code: ```lua local tycoon = script.Parent.Parent
local marketplaceservice = game:GetService("MarketplaceService")
local MainItems = tycoon:FindFirstChild("MainItems")
local Values = tycoon:FindFirstChild("Values")
local Buttons = tycoon:FindFirstChild("Buttons")
local PurchasedItems = tycoon:FindFirstChild("PurchasedItems")
local audio = tycoon:FindFirstChild("Audio")
local objects = {}
local debounce = false

if Buttons then
for i, v in pairs(Buttons:GetChildren()) do
spawn(function()
if v:FindFirstChild("Button") then

            local newObject = PurchasedItems:FindFirstChild(v.Object.Value)
            if newObject ~= nil then
                objects[newObject.Name] = newObject:Clone()
                newObject:Destroy()
            else
                v:Destroy()
            end ```

The context of this is a tycoon game where when you walk on a button a dropper appears but before you walk on it its not there (basically a normal tycoon button) This script works, im just trying to figure out what in the script makes the dropper be invisible until you use the button. ive included a picture of the folders that I THINK the script is using and also all of the variables in the script

karmic jolt
#

RustySillyBand 🔥🔥🔥🔥

karmic jolt
#

It’s cloned from replicated storage

steep solar
# karmic jolt It’s cloned from replicated storage

ohhhhhhhhhhhhhhhhhhhhh. so specifically this part local newObject = PurchasedItems:FindFirstChild(v.Object.Value) if newObject ~= nil then objects[newObject.Name] = newObject:Clone() newObject:Destroy() else v:Destroy() is cloning the dropper from the replicated storage?

#

just wanna make sure

karmic jolt
#

Yes

#

The destroy is as when u claim the tycoon everything spawns then what u dont own gets deleted @steep solar

steep solar