I have a script that is running "while true do" but I need another script to stop the loop and disable the script, but I cant figure out how to do it, No matter what I try.
This is the script. What would I do in another script to make it stop the script from running, and then disable this script?
ELS = script.Parent while true do wait(0) if ELS.lbon.Value == 1 then ELS.Lightbar1.FLBR.Transparency = 0 ELS.Lightbar1.LB1.Transparency = 0 ELS.Lightbar1.LB2.Transparency = 0 ELS.Lightbar1.LB3.Transparency = 0 ELS.Lightbar1.LB4.Transparency = 0 ELS.Lightbar1.FLBL.Transparency = 0 elseif ELS.lbon.Value == 2 then ELS.Lightbar1.RLBR.Transparency = 1 ELS.Lightbar1.FLBR.Transparency = 0 ELS.Lightbar1.LB1.Transparency = 1 ELS.Lightbar1.LB2.Transparency = 0 ELS.Lightbar1.LB3.Transparency = 1 ELS.Lightbar1.LB4.Transparency = 0 ELS.Lightbar1.FLBL.Transparency = 1 ELS.Lightbar1.RLBL.Transparency = 0 wait(0.2) ELS.Lightbar1.RLBR.Transparency = 0 ELS.Lightbar1.FLBR.Transparency = 1 ELS.Lightbar1.LB1.Transparency = 0 ELS.Lightbar1.LB2.Transparency = 1 ELS.Lightbar1.LB3.Transparency = 0 ELS.Lightbar1.LB4.Transparency = 1 ELS.Lightbar1.FLBL.Transparency = 0 ELS.Lightbar1.RLBL.Transparency = 1 wait(0.2) ELS.Lightbar1.RLBR.Transparency = 1 ELS.Lightbar1.FLBR.Transparency = 0 ELS.Lightbar1.LB1.Transparency = 1 ELS.Lightbar1.LB2.Transparency = 0 ELS.Lightbar1.LB3.Transparency = 1 ELS.Lightbar1.LB4.Transparency = 0 ELS.Lightbar1.FLBL.Transparency = 1 ELS.Lightbar1.RLBL.Transparency = 0 wait(0.2) ELS.Lightbar1.RLBR.Transparency = 0 ELS.Lightbar1.FLBR.Transparency = 1 ELS.Lightbar1.LB1.Transparency = 0 ELS.Lightbar1.LB2.Transparency = 1 ELS.Lightbar1.LB3.Transparency = 0 ELS.Lightbar1.LB4.Transparency = 1 ELS.Lightbar1.FLBL.Transparency = 0 ELS.Lightbar1.RLBL.Transparency = 1 wait(0.2) elseif ELS.lbon.Value == 3 then ELS.Lightbar1.RLBR.Transparency = 1 ELS.Lightbar1.FLBR.Transparency = 1 ELS.Lightbar1.LB1.Transparency = 1 ELS.Lightbar1.LB2.Transparency = 1 ELS.Lightbar1.LB3.Transparency = 1 ELS.Lightbar1.LB4.Transparency = 1 ELS.Lightbar1.FLBL.Transparency = 1 ELS.Lightbar1.RLBL.Transparency = 1 end end
All you need is a return false!
Example While Loop with 'return false'
local number = 5 while true do wait(0.1) if number > 0 then number -= 1 print("Iteration") else return false -- What you need! end end
Hope this helped!