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

GUI if script disabled breaks other scripts?

Asked by 8 years ago

So I have a script in my GUI that detects a script in the workspace that if disabled, makes the GUI disappear. However, this just breaks the game instead. Anyone see why?

repeat wait() until game.Workspace.Lights.Sequence.Script.Disabled == false -- This will keep the code from continuing until LoadVal is disabled.

-- Below is what you want to happen when it does.
    script.Parent.BackgroundTransparency = 0.1
    script.Parent.TextButton.TextTransparency = 0.1
    wait(0.1)
    script.Parent.BackgroundTransparency = 0.2
    script.Parent.TextButton.TextTransparency = 0.2
    wait(0.1)
    script.Parent.BackgroundTransparency = 0.3
    script.Parent.TextButton.TextTransparency = 0.3
    wait(0.1)
    script.Parent.BackgroundTransparency = 0.4
    script.Parent.TextButton.TextTransparency = 0.4
    wait(0.1)
    script.Parent.BackgroundTransparency = 0.5
    script.Parent.TextButton.TextTransparency = 0.5
    wait(0.1)
    script.Parent.BackgroundTransparency = 0.6
    script.Parent.TextButton.TextTransparency = 0.6
    wait(0.1)
    script.Parent.BackgroundTransparency = 0.7
    script.Parent.TextButton.TextTransparency = 0.7
    wait(0.1)
    script.Parent.BackgroundTransparency = 0.8
    script.Parent.TextButton.TextTransparency = 0.8
    wait(0.1)
    script.Parent.BackgroundTransparency = 0.9
    script.Parent.TextButton.TextTransparency = 0.9
    wait(0.1)
    script.Parent.BackgroundTransparency = 1
    script.Parent.TextButton.TextTransparency = 1

Cheers,

Michael

0
Is the script that is checking this a localscript? Are you attempting to make the code happen when the script is disabled or not disabled? shayner32 478 — 8y
0
Both scripts are standard scripts. Michael007800 144 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

I've often found repeat wait() until -- code is often breaking, so as a backup, I do while loops. I'd probably do this instead:

while game.Workspace.Lights.Sequence.Script.Disabled == false do wait() end

for i = 1,10 do
    script.Parent.TextButton.TextTransparency = script.Parent.TextButton.TextTransparency + 0.1
    script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency + 0.1
    wait(0.1)
end

Ad

Answer this question