So this is a script and this is the original,
On=false function onClicked() if On then On=false else On=true while On do game.Workspace.Test2.Light1.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light2.BrickColor = BrickColor.new("Really red") game.Workspace.Test2.Light3.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light4.BrickColor = BrickColor.new("Really red") wait(0.1) game.Workspace.Test2.Light1.BrickColor = BrickColor.new("Really red") game.Workspace.Test2.Light2.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light3.BrickColor = BrickColor.new("Really red") game.Workspace.Test2.Light4.BrickColor = BrickColor.new("Medium stone grey") wait(0.1) game.Workspace.Test2.Light1.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light2.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light3.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light4.BrickColor = BrickColor.new("Medium stone grey") wait(0.1) end end end script.Parent.MouseButton1Down:connect(onClicked)
That is all squared away and finished, now I made this script to be turned on when the other one is turned off so the other one turns off and immediately this comes on to shut it all down
On=false function onClicked() if On then On=false else On=true while On do game.Workspace.Test2.Light1.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light2.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light3.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light4.BrickColor = BrickColor.new("Medium stone grey") wait(0) end end end script.Parent.MouseButton1Down:connect(onClicked)
And I am not sure how I want to go about this, I have tried many different ways and it is too much for me to handle. But that is what I have on the bottom and it is not working. I want the "Lights" to turn off the second I click. Is there a way to disable or enable the script? I am very lost and need someone to finish the puzzle. This is the last tiny bit of help I need and then I will be done and finished with my project. Does anybody have any ideas?
Instead of disabling and enabling scripts you could simply make it so while the variable on is false, it makes sure all the lights are off, and while it's true, the lights go through their flashing cycle.
local on = false script.Parent.MouseButton1Down:connect(onClicked) if not on then on = true elseif on then on = false end end) while on do game.Workspace.Test2.Light1.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light2.BrickColor = BrickColor.new("Really red") game.Workspace.Test2.Light3.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light4.BrickColor = BrickColor.new("Really red") wait(0.1) game.Workspace.Test2.Light1.BrickColor = BrickColor.new("Really red") game.Workspace.Test2.Light2.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light3.BrickColor = BrickColor.new("Really red") game.Workspace.Test2.Light4.BrickColor = BrickColor.new("Medium stone grey") wait(0.1) game.Workspace.Test2.Light1.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light2.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light3.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light4.BrickColor = BrickColor.new("Medium stone grey") wait(0.1) end while not on do game.Workspace.Test2.Light1.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light2.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light3.BrickColor = BrickColor.new("Medium stone grey") game.Workspace.Test2.Light4.BrickColor = BrickColor.new("Medium stone grey") wait() end