of     1   

Damo999
#149900500Sunday, November 16, 2014 9:25 PM GMT

like the title says how would i fix this script so when i press a button the script runs then when i press it the script stops and when i press it again it runs again i already started on the code but i'm suck can anyone help me out? bar1 = script.Parent.Bar1 bar2 = script.Parent.Bar2 bar3 = script.Parent.Bar3 bar4 = script.Parent.Bar4 bar5 = script.Parent.Bar5 bar6 = script.Parent.Bar6 bar7 = script.Parent.Bar7 bar8 = script.Parent.Bar8 bar9 = script.Parent.Bar9 mouse = game.Players.LocalPlayer:GetMouse() button = game.Workspace.Part cl = Instance.new("ClickDetector",button) isDown = false button.ClickDetector.MouseClick:connect(function() if not isDown then isDown = true while isDown do wait(5) bar1.Transparency = 1 wait(5) bar2.Transparency = 1 wait(5) bar3.Transparency = 1 wait(5) bar4.Transparency = 1 wait(5) bar5.Transparency = 1 wait(5) bar6.Transparency = 1 wait(5) bar7.Transparency = 1 wait(5) bar8.Transparency = 1 wait(5) bar9.Transparency = 1 break end else if isDown == true then isDown = false print("False") end end end)
Rockenite
#149900658Sunday, November 16, 2014 9:27 PM GMT

In the script, the bool property "Disabled" is what shuts down a scripts functionality. If you want to make the script around this you could. Script.Disabled = true Script.Disabled = false altho I suggest using another script to enable and disable as if you disable the script, you couldn't use the same script to enable.
CynicalBusiness
#149901745Sunday, November 16, 2014 9:42 PM GMT

@rockandgreen Disabling the script does not stop execution, believe it or not. It only prevents future events from firing and the script from executing from the beginning. To disable the script, "break" out of any loops, then call "return" in the main instance (not inside of a function). Alternatively, crash the script with the error() function, then simply disable and re-enable.
djwill619
#149901906Sunday, November 16, 2014 9:45 PM GMT

What I do is put a BoolValue in the script and on your if statements put: and script.Value == true then. Then in the script toggle the Value.
JarodOfOrbiter
#149902181Sunday, November 16, 2014 9:49 PM GMT

Never do "if Blah == true then". Always do "if Blah then". It is more efficient, and does almost the same thing.
Damo999
#149904448Sunday, November 16, 2014 10:19 PM GMT

Okay i pretty much got the script to toggle between disabled = true and false but now the problem is that once the script is re-enabled the script doesn't continue to run where it was at last is there a fix for this?.
Rockenite
#149909305Sunday, November 16, 2014 11:25 PM GMT

@Wettham Wow I didn't know, Thanks.
Rockenite
#149909362Sunday, November 16, 2014 11:26 PM GMT

*Wehttam @Damo999 may we see an output to help?

    of     1