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

Why does my stuff load faster in play solo but not in game?

1 answer

When I search the wiki for "loading screen", this is the first thing that appears: Custom loading screen.

The reason it works instantly in Play Solo is because everything is already there. The server and the client are the same. Online, or in Start Server/Player, when you join a game, everything has to be sent (well, the right verb is "to replicate", thus "replicated") from the server to the client. This takes a bit of time, so it could be a localscript arrives and runs before some GUIs or IntValues (basicly anything) are loaded too.

A simple fix would be using WaitForChild:

-- This could error if Model isn't replicated yet:
print(workspace.Model)

-- This would wait until Model is found in the Workspace:
print(workspace:WaitForChild("Model"))
-- Model might already be there, then it'll be returned immediatly
-- Model might not be there yet, then WaitForChild will wait until it is

WaitForChild will wait (well, we say "yield") until it finds "Model" (or whatever you want) in the workspace (or whatever you use it on).

Tip: If your code doesn't seem to run, check (with print statements) if you aren't doing something:WaitForChild("Something") while Something isn't there (and never will be). It wouldn't be the first time someone writes WaitForChild("model")instead of WaitForChild("Model"). (Or doing A:WaitForChild("C") while it should be A:WaitForChild("B"):WaitForChild("C"))

1 comment

0

thank you dude, i actuall have no idea why i wasnt using wait for child in the first place. thanks alot

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