Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What do I put before a script to make it wait until everything loads?

Hello.

I have received many ways on how to do this but none, seem to have a easy way, or basic solution out. I just want a line, or a couple, before a script that makes it wait, until the WHOLE game loads, like in Murder Mystery 2 or Tower Defense Simulator. I want it so that the script loads at different times for people with different devices, so like if you have a really BEEFY PC you can load the game faster, without any excessive loading, or if someone has a really slow PC it would load too early. I want it so that everyone sees the same functions of the script, so they wait, instead of paying the cost of accidentally missing it when they have a slower computer.

All I need is the couple of lines that I just can't seem to find on loading all of the game's services.

2 answers

✓ Accepted answer

(this is a direct import from this)

You can use game.ContentProvider.RequestQueueSize in order to wait until everything has been loaded.

By default, ROBLOX has it's own loading screen (the one you see when you're entering a normal game) so there isn't really a need to do this unless you have heavy-duty tasks that make the loading screen timeout.

Anyways, when game.ContentProvider.RequestQueueSize reaches 0, it means everything that the player can access, load. I'm unaware if its the same for the server but this should help you out:

--[[
	
    Type: "LocalScript"
    Location: "game.ReplicatedFirst"

--]]

local Start = tick()

repeat wait() until game.ContentProvider.RequestQueueSize == 0 -- This will yield until everything is loaded

print('Time took to load: ', tick()-Start)

You can loop the script for like 30 seconds so get the loading gui then put.

wait(30) then destroy the script.

1 comment

0

He clearly states he wants the optimal load times dependent on the client's available processing power. Not a fixed amount!

This discussion is preserved as it was. New answers, comments, and votes are closed.