I have a childAdded event listening to models being added on the client. Before I start utilising the model, I have to make sure the model’s children have fully loaded and I do not want anything to be hardcoded as I have right now.
Right now, I basically have a :WaitForChild(“replicatedPart”, 2) under the childAdded which does the job but you do need that “replicatedPart” and I do not want that. Without the waitforchild, the model’s children aren’t loaded by the time the listener fires and the Model’s Children amount to 0.
I want it to be “automated” and try to avoid using remotes, is there a way to do this please?
It does do the job but you need a defined “replicatedPart” within the model which I want to avoid. Hence, I posted here to see if there might be an alternative.
I just want to know whether the model’s children have replicated without needing a model’s child’s name (in this case it’s “replicatedPart”) if that makes sense.
Okay but that will not tell you whether a models children replicated, that will tell you if there a part called “replicatedPart” replicated (unless all models children replicate at the same time so if one exists then the rest exists idk, but then I see what your problem is)
The server parents the model to workspace, I have a childAdded event on client but when it fires the model’s children amount to 0, once the model replicates I want to do something with it such as tweening it.
I did have that in mind but I try to avoid polling based approaches.
Another thing is that the childamount varies since I’m going to have different models so I’d have to give that some thought as well.
Should edit GetChildren to GetDescendants. This would mean that all assets are loaded in the model instead of just the first line of assets under the model.
There is a service for that. It isn’t quite well known. ContentProvider can be used for checking the loading of assets into a game. Simply put the model in PreloadAsync() in a list and it will wait for it too load.
Yeah. I usually use ContentProvider for loading screens as it allows time for textures to load into the game.
This is actually code I have for it.
for i, children in pairs(workspace:GetChildren()) do
pcall(function() -- ContentProvider sometimes fails.
textLabel.Text = "Loading: "..children.Name
ContentProvider:PreloadAsync({children})
end)
end