#ScrollingFrame's ChildAdded Function isn't triggering

1 messages · Page 1 of 1 (latest)

tropic dawn
#

This requires some background context:

I have a ScrollingFrame in the PlayerGUI which has a script called SetupBuy, which creates the list of items in the ScrollingFrame based on a template so that no matter how many items I add, it’ll automatically update the ScrollingFrame list.

I cannot fit the script in the main post so it'll be a reply to this.

#

And this is the hierarchy to show exactly where the template is:

#

Now in the BuyScript, there is supposed to be some code to check if ChildAdded occurs on the ScrollingFrame, and then have the Buy Buttons work respectively. However, the script doesn’t work for some reason, so I’ve simplified it to just print a statement when ChildAdded occurs to try and troubleshoot the problem:

local parentInstance = script.Parent

parentInstance.ChildAdded:Connect(function(seedItem)
    print(seedItem.Name .. " added to the " .. parentInstance)
end)
```No matter how I approach this, this print statement doesn’t fire in the console, so what exactly am I missing here?
charred mesa
#

Maybe buyscript runs before setupbuy so childadded happens after all of the children were already added?

#

you can try to add a task.wait at the top of the script to make it run after setupbuy

tropic dawn
#

I ended up merging both scripts together and putting ChildAdded on top of the for Loop. And it worked pretty well.