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