Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

How to tell if a model is finished loading?

Asked by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
8 years ago

Hi all! It's one of those rare questions I have. Say if I have a model in ServerStorage, and I clone it, parenting it to Workspace. Obviously, it won't just pop up right away, it'll load part by part (considering it's a large model, such as a map). Is there a pre-set function or property I could use to tell when it's finished loading? I've noticed in several games, they've cracked the nutshell on how to do this, but sadly I can't. Any ideas?

Thanks in advance.

0
maybe make a for loop that copies everything in the model and places it into another model 1 by 1? Teeter11 281 — 8y
0
that way you know when it starts and when it ends Teeter11 281 — 8y
0
Wow a rare question from you , someone give this man a good answer . KelsiCabana 70 — 8y

1 answer

Log in to vote
4
Answered by 8 years ago

Well, there's two fundamental issues to tackle here, so let's get to that.

The content queue.
You remember that good old guide you've probably looked at once upon a time explaining how to make a custom loading screen? Well, the same applies here: By using the ContentProvider.RequestQueueSize, you can tell when there's no more parts streaming in to the client. This is super useful for you, by the way.

Replication
Why do you have to move it from ServerStorage to the client right at that moment? Why not put the stuff in ReplicatedStorage and either have the client clone it or let the server move it. Either way, it can be replicated ahead of time.
To best explain this idea, consider that you have a minigame system. At the end of the round, a new map is chosen, and at the start of the new round the map is cloned in. If you choose the map ahead of time, you can get the map replicated (via ReplicatedStorage) and ready whilst people are playing their minigames, which reduces any loading times phenomenally by removing the waiting times from replication.

2
This is a good explanation, however I was under the impression RequestQueueSize only returns user-made assets that are in queue. Is there more to this that I'm missing? ScriptGuider 5640 — 8y
0
RequestQueueSize should return the size of the replication queue as well; If it is suggested to be used for a loading screen, there has to be some way to know when all the parts in the game are loaded, no? User#6546 35 — 8y
0
I see what you mean, but through an experiment of parenting a model with 5,000 parts all in which individually have a random material set to them, directly to the workspace, the RequestQueueSize doesn't seem to change at all. ScriptGuider 5640 — 8y
0
If you want to see what I mean, here's the place where I tested it: http://www.roblox.com/games/379567100/Something#!/game-instances - the model is in ServerStorage and parents itself to workspace after 10 seconds. Use the dev console to see the results. ScriptGuider 5640 — 8y
0
I'll take a look at how it actually works tomorrow. Either way, the second answer is still very valid. User#6546 35 — 8y
Ad

Answer this question