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

How should I wait until the player has loaded his game for sure?

I'm making a starting screen, kind of an intro, for a game. While doing it, I got into wondering what I usually wonder when doing stuff like this: how should I recognize if a player has loaded his game already or not? In this case we're talking about a situation where the player has no character. Different computers, of course, take different times to load. Adding wait() shouldn't work that good in that case. This game is also single player if that makes your job easier at all. There's Loaded() event for game, which could be a solution. Still, I probably have to do this to a multiplayer game in the future, so it would be good if you could provide the most information you can.

Thanks,

SwaggyDuckie

1 answer

You can use the ContentProvider to detect if the game is fully loaded for the player. Event though i'm not fully use to it, here's example which will print how long it took for the player's stuff to load :

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local before = tick(); --Preceding tick function

repeat wait() until game.ContentProvider.RequestQueueSize == 0

local after = tick(); --Proceeding tick function
print("It took "..after-before.."seconds to load");

3 comments

0

This is a way that won't work as ContentProvider works with assets and doesn't recognize if the parts or any other non-asset instances have been loaded.

0

this is the nearest you can come to doing that in roblox unfortunately

0

And that would not really work as roblox won't render the whole place to prevent lag and also streamingenabled

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