Detecting if parts are loaded in

Hi, how can I detect if parts are loaded into the workspace? I’m trying to load in a map but I don’t want to teleport the player if it’d not loaded in. How can I do this?


I have no idea if this would work or not, and it’s probably hacky, but what if you stored a number value with the number of parts for the map (or the minimum parts needed to load for the player) that the client can read from and compare the number of descendants of the map to? Also given that I’m not wrong when I say when a map is replicated to the client not all the parts are already existing in memory for said client, leading this solution to work. I haven’t tested this idea so yeah :man_shrugging:

There might be a better way though, but nothing I’m aware of. I usually just use wait to give some asset time to load in for the client, which doesn’t seem super good either.

1 Like

That was my next best solution to see how many parts were there, I’ll see if this works out.





You should use WaitForChild and FindFirstChild to do this.

1 Like

Is there any way to prioritize what parts load in first? CC: @C_Sharper @ozyubkx

In my original script, I detected if the number of parts is greater than 80% but it doesn’t load in spawns sometimes.

1 Like

But as for that problem, you can just check if the spawns have loaded in by using findfirstchild. Also, the requestqueuesize may change so I suggest waiting couple seconds after the desired percentage to see if it changes.

1 Like

You can’t use PreloadAsync on parts.

WaitForChild is the function OP needs, and is standard practice for this type of thing.

Wait, you want to make a Game/Map Preloading system ? Something like this ?

I plan to look into something like that in the future, it’s just for loading in a random map that was cloned to the workspace.

1 Like

Try something like that ?

local ContentProvider = game:GetService("ContentProvider")
for i, children in pairs(HERE-THE-PATH :GetChildren()) do 

This is work ? You have a problem with the code ?

It has worked, but how do I do that loading UI so that players don’t think the game broke?

1 Like

Use TweenSize with a Frame for make a bar
in the for, call a function that having i/100
Ex : i = 8 8/100 will give 0.8 then you move with TweenSize

1 Like

In fact since you load a model instead of 100 you have to put the number of objects that contain in total what you want to load
Like this

local childrenNum = HERE-THE-PATH :GetChildren()
and after doing something like i/#childrenNum

1 Like

I know this conversation is very old, but if you want to get all of the instances inside of the model, use :GetDescendants() instead of :GetChildren().