krisk7
|
  |
| Joined: 24 Aug 2013 |
| Total Posts: 254 |
|
|
| 09 Aug 2014 02:32 AM |
So I have a smoke enabler script:
smk = script.Parent.Parent.Button.Smoke
function onTouched() smk.Enabled = true wait(2) smk.Enabled = false
end
script.Parent.Touched:connect(onTouched)
Basically I touch the button and the smoke appears for 2 seconds then disappears. The problem is when I touch the brick again the smoke appears again. Even if I do something like:
function onTouched() smk.Enabled = true wait(2) smk.Enabled = false wait(100)
end
it still continues to activate. What I want is to disable the script for about 100 seconds after the smoke goes away. How do I do that? |
|
|
| Report Abuse |
|
|
ehern11
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1541 |
|
| |
|
Mitko0o1
|
  |
| Joined: 30 Nov 2010 |
| Total Posts: 5725 |
|
|
| 09 Aug 2014 03:09 AM |
smk = script.Parent.Parent.Button.Smoke
db = true
function onTouched() if db then db = false smk.Enabled = true wait(2) smk.Enabled = false wait() --< Optional >-- db = true
end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
krisk7
|
  |
| Joined: 24 Aug 2013 |
| Total Posts: 254 |
|
|
| 09 Aug 2014 03:59 AM |
| Now the script doesn't work at all. |
|
|
| Report Abuse |
|
|
krisk7
|
  |
| Joined: 24 Aug 2013 |
| Total Posts: 254 |
|
|
| 09 Aug 2014 05:09 PM |
So I edited the script so now it actually works but I still have the same problem:
smk = script.Parent.Parent.Button.Smoke
function onTouched() db = false wait(2) smk.Enabled = true wait(2) smk.Enabled = false db = true wait(50) db = false
end
script.Parent.Touched:connect(onTouched)
Even if I add the wait(50) at the end it still doesn't disable the script. I want the smoke to be unable to activate (for about 50 seconds) even if I step on the brick again. |
|
|
| Report Abuse |
|
|
ehern11
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1541 |
|
|
| 09 Aug 2014 05:42 PM |
db = false
smk = script.Parent.Parent.Button.Smoke
script.Parent.Touched:connect(function() if db == false then db = true wait(2) smk.Enabled = true wait(2) smk.Enabled = false if db == true then wait(50) db = false
end end end) |
|
|
| Report Abuse |
|
|