generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: How do I disable this script

Previous Thread :: Next Thread 
krisk7 is not online. 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 is not online. ehern11
Joined: 23 Apr 2011
Total Posts: 1541
09 Aug 2014 03:02 AM
use debounce
Report Abuse
Mitko0o1 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image