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

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

Asked by 4 years ago

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

Log in to vote
1
Answered by
SmartNode 383 Moderation Voter
4 years ago

(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)
Ad
Log in to vote
-1
Answered by 4 years ago

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

wait(30) then destroy the script.

0
He clearly states he wants the optimal load times dependent on the client's available processing power. Not a fixed amount! SmartNode 383 — 4y

Answer this question