tub=script.Parent button=tub.button smoke=tub.smoke smokes={smoke.Part,smoke.Part1,smoke.Part2,smoke.Part3} debounce=true print("Loaded: ",script.Name) print("Made a ClickDetector.. in ",button.Name) button.ClickDetector.MouseClick:connect(function() if debounce==true then debounce=false if button.ClickDetector~=nil then print("Making Smoke in all Parts specified") w1=Instance.new("Smoke",smokes[1]) w1.Opacity=0.1 w1.RiseVelocity=2 -- w2=Instance.new("Smoke",smokes[2]) w2.Opacity=0.1 w2.RiseVelocity=2 -- w3=Instance.new("Smoke",smokes[3]) w3.Opacity=0.1 w3.RiseVelocity=2 -- w4=Instance.new("Smoke",smokes[4]) w4.Opacity=0.1 w4.RiseVelocity=2 print("Made smoke on all Parts specified") -- tub.button.ClickDetector:Destroy() end debounce=true print("Made a new ClickDetector and removed the previous one") q=Instance.new("ClickDetector",tub.button) q.Name="omgNightstopHackingme" print("Renamed the current ClickDetector to: ",q.Name) button.omgNightstopHackingme.MouseClick:connect(function() if debounce==true then debounce=false smoke.Part.Smoke:Destroy() smoke.Part1.Smoke:Destroy() smoke.Part2.Smoke:Destroy() smoke.Part3.Smoke:Destroy() print("Destroyed all Smoke. Waiting 3 seconds") wait(3) q:Destroy() print("Destroyed ",q.Name,", Now waiting 5 seconds until debounce is True") wait(5) end debounce=true end) end debounce=true Instance.new("ClickDetector",button) print("Made a new ClickDetector in ",button.Name) end)
Sorry about all the prints, It's for debugging. I'm trying to figure out how to make the ClickDetector clickable again when the script ends, so you can repeat the function(s). Help would be appreciated!