my problem is that I'm making a Table of all the children in the Model Orb and what I want it to do is on touch of the Orb make the model go invis and 5 seconds later come make to visible. when the code is ran and then I touch the part it goes invis 1 part at a time every 5 seconds. I know its because its looping but is there anyway I can make a table that does not loop and still uses GetChildren. THANK YOU for reading
```lua local Orb = script.Parent:GetChildren()
function onTouched() for i, v in pairs(Orb) do v.Transparency = 1 wait(5) v.Transparency = 0 end end
script.Parent.Part.Touched:connect(onTouched) ```
Your codes are waiting 5 seconds on the same part. A generic for loop generally traverses a table. i
is the position of v
in the array returned by instance:GetChildren()
.
When the code in the loop is complete it moves on to the next element. And it keeps going until the last element is reached.
What you can do is have two separate loops (like mentioned by M39a9am3R).
Something like this
```lua local orbs = script.Parent:GetChildren();
for _, orb in ipairs(orbs) do orb.Transparency = 1; end
wait(5); --// Wait 5 seconds before going to the next loop
for _, orb in ipairs(orbs) do orb.Transparency = 0; end ```