Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Multiple parameters in for pair loops?

Asked by 3 years ago
for _, gui in pairs(script.Parent.Abilities:GetChildren() and script.Parent.Passives:GetChildren())do

end)

As shown in the code above, when I use "and" it only loops through the 2nd argument, vice versa if I use "or" it only loops through the 1st argument. I was wondering if there is a way to achieve looping through both parameters without making 2 separate loops thanks.

0
You could make a new table with all of the values inside of it. I don't really see a different way of doing it. I recommend merging the tables with a for loop. rabbi99 714 — 3y
0
REAL TIN CAN !! ! ! !!! ! :D WHERE HAVE U beEEEEEEEEEEEEEeeeennnnnnnnnnn greatneil80 2647 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago

You could always get descendants but that will return all the children. You could filter it by adding an if statement, its better if I show you the code.

for _, gui in pairs(script.Parent.Abilities:GetDescendants()) do
    if gui.Parent.Name == "so and so... the folder or frame u want to get" then
        -- ... code ...
    end
end)

If this helped, i'd appreciate this being accepted, have a question, add a comment. Good luck.

0
omg my man I will be BACK AND SEE YOU ONE DAY TYYYY!!!!! RealTinCan 217 — 3y
0
anytime BRUDDuH greatneil80 2647 — 3y
Ad

Answer this question