How to reference the children and the children's children in a folder

Hey there, I’m making a sort of story game for myself and I’m finding myself to be stuck. I’m trying to make berries appear AND the ProximityPrompts inside of those berries after a previous ProximityPrompt has been activated. I’m using the transparency and CanCollide to make them invisible before that prompt has been activated.
The issue now is that I don’t know how to select the berries in the folder and change all their transparencies to 0 at once, while I also select the berries’ children by themselves (the ProximityPrompts).
Heres a screenshot of what the folder looks like:
Screenshot 2023-01-06 at 13.57.13

I have tried looking on YouTube and the DevForum but I can’t seem to find any topics regarding my question.
Thanks for reading!

you can use berries:GetChildren to get all the berries and berries:GetDescendants() to get both

1 Like

Yes I know that, but I need to select the ProximityPrompts without selecting the actual object, as the berry parts don’t have .Enabled

for i, v in ipairs(berries:GetDescendants()) do
    if v:IsA("ProximityPrompt") then
    -- do stuff
1 Like

Use IsA() to know if the parts are a proximity prompt


Using :GetDescendants before? That makes sense I think.

I believe your example is right however you would not say v.IsA() you would say v:IsA() with a column

Yes, i noticed and corrected it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.