Ad
Log in to vote
0

Why do my scripts act differently online?

Asked by 7 years ago

I am used to testing things in Solo Play on studio but when I went to test Online, it doesn't work anymore and I get a bunch of errors that I fixed using "wait(5)"

One error is related to the fact that the StarterGui loads after the Backpack.

Not only that but a bunch of scripts unrelated to the GUIs only have bugged and don't even show a error output.

Is there a simple fix or do I need to go through my scripts again?

PS: Since scripts running in Solo Play are local, does changing all the scripts into Local Script works?

0
I found that scripts tend to break when they're Localscripts in a non-FilteringEnabled server for clients. You'll need to know when it's the best time to use a LocalScript and a Server Script. TofuBytes 500 — 7y
0
Is it best to use local scripts for GUIs? Since they run locally? Powerhalo 10 — 7y
0
You can *only* use LocalScripts inside the PlayerGui. Scripts do not run there. adark 5477 — 7y

1 answer

Log in to vote
0
Answered by
adark 5477 Badge of Merit Moderation Voter Community Moderator
7 years ago

Your problems seem to be ones of timing. When using Play Solo (and to a lesser extent Start Server > Start Player), everything pretty much loads instantly. You don't have to check if something you put there exists: it will already have loaded.

Play Solo loads so fast, even, that PlayerAdded events may not have a chance to connect before the Player has joined.

I don't know your scripts, but I suggest going through them and figuring out what they are assuming to exist. If you're not absolutely sure that what they're assuming exists actually does (you can only be absolutely sure if the assumption in question is a direct ancestor of the script), use the WaitForChild method of all Instances (that aren't in nil) to, well, wait for what you assume exists to exist.

Ad

Answer this question