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

Does the script fully execute?

Asked by 4 years ago
Edited 4 years ago

Hi there!

My issue is this...

The players action executes the script below and all is well, but if the player then quits during one of the "wait" periods, does the script fully execute or not.

It seems that sometimes the rain continues to fall and does not always stop, so Im thinking that it's maybe because the player quits before the script has a chance to signal the rain to stop?

The script below is in workspace and the Rain script is in serverscripts.

Here is a snippet of the code:

    Mainsound:Pause()
    Cheer:Play()
wait(2)
    Happysound:Play()
    Happysound.Volume = .3


    rain.Disabled = false

    Mainsound.Volume = 0


    wait(30)  **<<<<<<<<<< this is where Im thinking if they quit, does the rest of the script continue or does it end here? **


    rain.Disabled = true   **<<<<<<< "rain" is a script in serverscripts that executes the rain**

    Mainsound:Resume()

    Mainsound.Volume = .07
    Happysound.Volume = .2

    wait(.5)

    Mainsound.Volume = .1
    Happysound.Volume = .1

thank you for any feedback!

2 answers

Log in to vote
0
Answered by 4 years ago

You cannot access ServerScriptService from workspace. The script in workspace must be in ServerScriptService to disable 'rain'. An alternative is to create another script in ServerScriptService that can disable 'rain' when needed.

0
I came back to post what I did to fix the issue and I saw your post. I ended up making another script in serverscripts to watch and disable... worked like a charm. Funny thing is the other method actually worked... just not consistently. Anyway thank you guys for the feedback! Issue resolved. scagnetti619 24 — 4y
Ad
Log in to vote
1
Answered by 4 years ago

Your script continues, you're using a wait command which means after 30 seconds, it will continue. The wait command is basically a timer before it can continue.

0
Thank you for the feedback. I understand what the wait command does. There must be some other reason the rain.Disabled is not always working. I will continue to troubleshoot. scagnetti619 24 — 4y

Answer this question