WHOTEI
(WHOTEI)
August 9, 2023, 12:31am
#1
I know I have a simple question…
This question was not solved by anyone successfully…
My question is…
Imagine you start this loop
For a, b in ipairs(folder:getchildren()) do
Wait 1
End
And while it is running you add another instance to the folder . The question is will it be included or not?
No it will not be included.
But how do you make it included???
Without restarting the loop?
7 Likes
You can turn the folder:getchildren()
into a variable
local children = folder:getchildren()
You can use the event that runs when something gets added in the folder.
folder.ChildAdded:Connect(function(child)
table.insert(children, child) -- and add it to the children
end)
Idk if that works, I never encountered questions like this before.
1 Like
WHOTEI
(WHOTEI)
August 9, 2023, 1:35am
#3
What about checking it because I cannot check it right now
1 Like
wdym about checking the parts?
WHOTEI
(WHOTEI)
August 9, 2023, 1:37am
#5
I’m talking about checking if it works because I’m 100% sure that it doesn’t work.
1 Like
Can you try if it works? I haven’t tried it yet so I don’t know.
1 Like
WHOTEI
(WHOTEI)
August 9, 2023, 1:39am
#7
But what about just trying it I tried it many times before And other ways and since you still have the same tablet are not Updating it it will not work
1 Like
WHOTEI
(WHOTEI)
August 9, 2023, 1:39am
#8
I need a method too update the table while the loop is running
1 Like
I believe I made a mistake above my post. Could you try again with this snippet?
WHOTEI
(WHOTEI)
August 9, 2023, 1:53am
#10
I don’t see to snip at you are talking about
1 Like
WHOTEI
(WHOTEI)
August 9, 2023, 1:53am
#11
Like I said I need a function that helps me to update
1 Like
WHOTEI
(WHOTEI)
August 9, 2023, 1:53am
#12
If I don’t have a function to update it makes no sense
1 Like
WHOTEI
(WHOTEI)
August 9, 2023, 1:54am
#13
Since the thing i’m trying to achieve is Making everything that cats added while the loop is running still be included
1 Like
You can turn the folder:getchildren() into a variable
local children = folder:getchildren()
You can use the event that runs when something gets added in the folder.
folder.ChildAdded:Connect(function(child)
table.insert(children, child) -- and add it to the children
end)
Idk if that works, I never encountered questions like this before.
Didn’t you see the code there?
WHOTEI
(WHOTEI)
August 9, 2023, 1:55am
#15
In fact I didn’t see it but this is not solving the problem
1 Like
WHOTEI
(WHOTEI)
August 9, 2023, 1:55am
#16
Like I said before I need the loop to update
1 Like
You didn’t see the event I wrote that fires everytime a new child has been added?
WHOTEI
(WHOTEI)
August 9, 2023, 1:56am
#18
How do I have to place it? And also will it automatically update the loop without having to run it again?
1 Like
WHOTEI
(WHOTEI)
August 9, 2023, 1:57am
#19
To answer your question? Yes, I did see it but I do not understand how I have to implement that.
1 Like
WHOTEI
(WHOTEI)
August 9, 2023, 1:58am
#20
I want to loop to run and include everything. Because I needed for an entity my door Game. If I were to restart a loop, the entity would not go smoothly through the rooms
1 Like