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