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 » Scripters
Home Search
 

Re: How can I add a debounce to this?

Previous Thread :: Next Thread 
TheIcyJake is not online. TheIcyJake
Joined: 26 Feb 2012
Total Posts: 335
06 Sep 2017 06:25 PM
function onTouch() script.Parent.Transparency = ### ################# #### ########################## = ### ################# #### ########################## = ### ################# #### ########################## = ### ################# #### ########################## = ### ################# #### ########################## = ### ################# #### ########################## = ### ################# #### ########################## = ### ################# #### ########################## = 0.9 wait (.2) script.Parent:Destroy() end script.Parent.Touched:connect(onTouch)
Report Abuse
TheIcyJake is not online. TheIcyJake
Joined: 26 Feb 2012
Total Posts: 335
06 Sep 2017 06:26 PM
https://hastebin . com/iqukimupog . pas
Report Abuse
gohan31865 is not online. gohan31865
Joined: 30 Jan 2011
Total Posts: 895
06 Sep 2017 06:29 PM
local debounce = false

function ontouch()
if debounce == false then
debounce = true
--code
wait(time u want)
debounce = false
end

debounce can be applied in anything, just define a variable as a bool value outside of the function, and then check inside the function if debounce is the same bool as the one defined before. if so, set it to the opposite and continue with the script

wait however long u like and then set the debounce back to the original bool
Report Abuse
TheIcyJake is not online. TheIcyJake
Joined: 26 Feb 2012
Total Posts: 335
06 Sep 2017 06:39 PM
https://hastebin .com / ofohewiyic . bash

Would that be right?
Report Abuse
gohan31865 is not online. gohan31865
Joined: 30 Jan 2011
Total Posts: 895
06 Sep 2017 06:44 PM
what u did was correct except for the wait()

replace the argument inside of wait() with whatever number u want

of course, u should know this by now

also a suggestion, try using a repeat loop so u won't have to manually adjust the transparency every time
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
06 Sep 2017 06:46 PM
Connect not connect and use a loop
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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