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

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

Asked by
Jumbuu 110
7 years ago

do i need to add a loading screen or something https://www.roblox.com/games/406924165/MajinJumbees-Place-Number-51 heres the link to the place, all the values and guis open perfectly in play solo but in game, its not getting added fast enough. if i do need a loading screen, can you please direct me to a wiki link, please and thank you

1 answer

Log in to vote
1
Answered by
einsteinK 145
7 years ago

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"))

0
thank you dude, i actuall have no idea why i wasnt using wait for child in the first place. thanks alot Jumbuu 110 — 7y
Ad

Answer this question