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

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

Asked by 6 years ago
Edited 6 years ago

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

Log in to vote
0
Answered by
oSyM8V3N 429 Moderation Voter
6 years ago

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");
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. SwaggyDuckie 70 — 6y
0
this is the nearest you can come to doing that in roblox unfortunately Filipalla 504 — 6y
0
And that would not really work as roblox won't render the whole place to prevent lag and also streamingenabled Filipalla 504 — 6y
Ad

Answer this question