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

What went wrong on this GUI?

Asked by 10 years ago

I am focused on the while off part. I do not want to wait for the lights to complete their rotation, if I hit the button I want them off.

On=false 
function onClicked() 
if On then On=false else 
On=true 
while On == true do 

    game.Workspace.Test5.Light1.BrickColor = BrickColor.new("Medium stone grey") 

    game.Workspace.Test5.Light2.BrickColor = BrickColor.new("Medium stone grey")  

    game.Workspace.Test5.Light3.BrickColor = BrickColor.new("Medium stone grey")

    game.Workspace.Test5.Light4.BrickColor = BrickColor.new("Medium stone grey")

    game.Workspace.Test5.Light5.BrickColor = BrickColor.new("Medium stone grey")

    game.Workspace.Test5.Light6.BrickColor = BrickColor.new("Really red")

    wait(0.4)

    game.Workspace.Test5.Light1.BrickColor = BrickColor.new("Medium stone grey") 

    game.Workspace.Test5.Light2.BrickColor = BrickColor.new("Medium stone grey")  

    game.Workspace.Test5.Light3.BrickColor = BrickColor.new("Medium stone grey")

    game.Workspace.Test5.Light4.BrickColor = BrickColor.new("Medium stone grey")

    game.Workspace.Test5.Light5.BrickColor = BrickColor.new("Really red")

    game.Workspace.Test5.Light6.BrickColor = BrickColor.new("Really red") 

    wait(0.4)

    game.Workspace.Test5.Light1.BrickColor = BrickColor.new("Medium stone grey") 

    game.Workspace.Test5.Light2.BrickColor = BrickColor.new("Medium stone grey")  

    game.Workspace.Test5.Light3.BrickColor = BrickColor.new("Medium stone grey")

    game.Workspace.Test5.Light4.BrickColor = BrickColor.new("Really red")

    game.Workspace.Test5.Light5.BrickColor = BrickColor.new("Really red")

    game.Workspace.Test5.Light6.BrickColor = BrickColor.new("Really red")

    wait(0.4)

    game.Workspace.Test5.Light1.BrickColor = BrickColor.new("Medium stone grey") 

    game.Workspace.Test5.Light2.BrickColor = BrickColor.new("Medium stone grey")  

    game.Workspace.Test5.Light3.BrickColor = BrickColor.new("Really red")

    game.Workspace.Test5.Light4.BrickColor = BrickColor.new("Really red")

    game.Workspace.Test5.Light5.BrickColor = BrickColor.new("Really red")

    game.Workspace.Test5.Light6.BrickColor = BrickColor.new("Really red")

    wait(0.4)

    game.Workspace.Test5.Light1.BrickColor = BrickColor.new("Medium stone grey") 

    game.Workspace.Test5.Light2.BrickColor = BrickColor.new("Really red")  

    game.Workspace.Test5.Light3.BrickColor = BrickColor.new("Really red")

    game.Workspace.Test5.Light4.BrickColor = BrickColor.new("Really red")

    game.Workspace.Test5.Light5.BrickColor = BrickColor.new("Really red")

    game.Workspace.Test5.Light6.BrickColor = BrickColor.new("Really red")

    wait(0.4)

    game.Workspace.Test5.Light1.BrickColor = BrickColor.new("Really red") 

    game.Workspace.Test5.Light2.BrickColor = BrickColor.new("Really red")  

    game.Workspace.Test5.Light3.BrickColor = BrickColor.new("Really red")

    game.Workspace.Test5.Light4.BrickColor = BrickColor.new("Really red")

    game.Workspace.Test5.Light5.BrickColor = BrickColor.new("Really red")

    game.Workspace.Test5.Light6.BrickColor = BrickColor.new("Really red")

    wait(0.4)

    game.Workspace.Test5.Light1.BrickColor = BrickColor.new("Medium stone grey") 

    game.Workspace.Test5.Light2.BrickColor = BrickColor.new("Medium stone grey")  

    game.Workspace.Test5.Light3.BrickColor = BrickColor.new("Medium stone grey")

    game.Workspace.Test5.Light4.BrickColor = BrickColor.new("Medium stone grey")

    game.Workspace.Test5.Light5.BrickColor = BrickColor.new("Medium stone grey")

    game.Workspace.Test5.Light6.BrickColor = BrickColor.new("Medium stone grey")

    wait(0)
end 
end
end

while On == false do

    game.Workspace.Test5.Light1.BrickColor = BrickColor.new("Medium stone grey") 

    game.Workspace.Test5.Light2.BrickColor = BrickColor.new("Medium stone grey")

    game.Workspace.Test5.Light3.BrickColor = BrickColor.new("Medium stone grey")

    game.Workspace.Test5.Light4.BrickColor = BrickColor.new("Medium stone grey")

    wait(0)
end


script.Parent.MouseButton1Down:connect(onClicked) 

Answer this question