How can I wait for all children to load

So I have a auto-save script which has a lot of data to save but when player joins and auto save is commencing it breaks because the children aren’t loaded yet.
How can I wait for the children to load other way than :WaitForChild?

1 Like

Do you want to load multipe things or just one thing?

I assume multiple things because I have a folder with player data

maybe this will work:
data is the folder/thing the data is in

local thingstoload = data:GetChildren()
for _,v in pairs(thingstoload) do
       repeat wait() until v
end
4 Likes

Sorry to bump, but just want to bring to attention this does not work for localscripts, if at all?:

image

GetChildren wouldn’t sensibly return anything that’s not there, by definition its the immediate children, and so it just runs empty for player’s acessories (my usecase) before they load.

I would appreciate if you explained how this ended up working out for you if at all, @Lemon553311

1 Like

Then add a little wait at the start like maybe .1 second

What’s the point of adding this method of checking if you placing wait to wait for it to load

You’re just waiting 0.1 seconds for it to load so you can check if it’s all loaded

What if after 0.1 seconds it won’t be loaded? Method still won’t work.

3 Likes

Maybe is game.IsLoaded a thing?

maybe ContentProvider:LoadAsync could help you, But i think it only preloads images and sounds