Hello guys sorry for bother (again.)
For example I want that, when you click on a button in the GUI (let's call the *"On / Off * button) That when I click on it the first time, repeat the script that I want infinitely and when I click it for second Once to the button, stop running the script that was running infinitely.
I think it's done with "While true do" loop but it does not work for me.
Any ideas? :(
local BoolValue = false function Click(mouse) if BoolValue == false then BoolValue = true print (BoolValue) script.Parent.Text = "On" else BoolValue = false print (BoolValue) script.Parent.Text = "Off" end end script.Parent.MouseButton1Down:Connect(Click) wait () while true do wait () if BoolValue == true then --code here end end
put this script in a local script in a text button