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: Button can be pressed again after 30 seconds

Previous Thread :: Next Thread 
EntityXF is not online. EntityXF
Joined: 25 Mar 2009
Total Posts: 370
24 Jul 2015 09:38 PM
So i have this button that people usually just keep spam clicking it and keeps annoying players with the sound that it makes (It's a ClickDetector). What could i add into the script that makes it force the player to wait 30 seconds for the button to be pressed again?


☃
Report Abuse
Clxver is not online. Clxver
Joined: 19 Oct 2014
Total Posts: 727
24 Jul 2015 09:43 PM
Add a debounce and wait 30 seconds before changing the debounce back to true?
Report Abuse
FactualTheory is not online. FactualTheory
Joined: 10 Sep 2013
Total Posts: 1365
24 Jul 2015 09:44 PM
add debounce, and then change the colout to lets say hot pink and then wait 30 and change it back.

ta da
Report Abuse
EntityXF is not online. EntityXF
Joined: 25 Mar 2009
Total Posts: 370
24 Jul 2015 10:01 PM
So how would it work with this script?

function onClick()
script.Parent.Parent.Judge1.X.Red.Enabled = true
script.Parent.Parent.Judge1.X.Gold.Enabled = false
script.Parent.Parent.Judge1.X.White.Enabled = false


script.Parent.Parent.Judge1.Tag.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Judge1Desk.Red.Enabled = true
script.Parent.Parent.Judge1Desk.Gold.Enabled = false
script.Parent.Parent.Judge1Desk.White.Enabled = false

script.Parent.Parent.Buzz:Play()

wait(0.01)
-------------------------------------------------------------------------------------------------------
if script.Parent.Parent.Judge1.X.Red.Enabled == true and script.Parent.Parent.Judge2.X.Red.Enabled == true and script.Parent.Parent.Judge3.X.Red.Enabled == true and script.Parent.Parent.Judge4.X.Red.Enabled == true then
script.Parent.Parent.Arches.L1.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L2.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L3.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L4.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L5.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L6.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L7.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L8.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L9.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.StageLight.Default.Color = script.Parent.Parent.Red.Value
script.Parent.Parent.Fail:Play()
script.Parent.Parent.Audio:Stop()
wait(5)
script.Parent.Parent.StageLight.Default.Color = script.Parent.Parent.White.Value
end


end
script.Parent.ClickDetector.MouseClick:connect(onClick)


☃
Report Abuse
GeoVolcano is not online. GeoVolcano
Joined: 05 Jul 2012
Total Posts: 1433
24 Jul 2015 10:03 PM
Gosh that's so inefficient code
Report Abuse
EntityXF is not online. EntityXF
Joined: 25 Mar 2009
Total Posts: 370
24 Jul 2015 10:04 PM
But it does the trick, lol


☃
Report Abuse
EntityXF is not online. EntityXF
Joined: 25 Mar 2009
Total Posts: 370
24 Jul 2015 10:16 PM
So how could i implement debounce into that? I'm not so great with code. ):


☃
Report Abuse
FactualTheory is not online. FactualTheory
Joined: 10 Sep 2013
Total Posts: 1365
24 Jul 2015 10:19 PM
INEFFICENT ALERT...

OMG LAG WILL BE SO INSANE
Report Abuse
EntityXF is not online. EntityXF
Joined: 25 Mar 2009
Total Posts: 370
24 Jul 2015 10:22 PM
Thanks for the heads up, but that's not my problem atm.


☃
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
24 Jul 2015 10:23 PM
local disabledTime = 30

local lastClick = 0
function onClick()
if tick() - lastClick < disabledTime then return end
lastClick = tick()

script.Parent.Parent.Judge1.X.Red.Enabled = true
script.Parent.Parent.Judge1.X.Gold.Enabled = false
script.Parent.Parent.Judge1.X.White.Enabled = false


script.Parent.Parent.Judge1.Tag.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Judge1Desk.Red.Enabled = true
script.Parent.Parent.Judge1Desk.Gold.Enabled = false
script.Parent.Parent.Judge1Desk.White.Enabled = false

script.Parent.Parent.Buzz:Play()

wait(0.01)
-------------------------------------------------------------------------------------------------------
if script.Parent.Parent.Judge1.X.Red.Enabled == true and script.Parent.Parent.Judge2.X.Red.Enabled == true and script.Parent.Parent.Judge3.X.Red.Enabled == true and script.Parent.Parent.Judge4.X.Red.Enabled == true then
script.Parent.Parent.Arches.L1.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L2.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L3.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L4.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L5.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L6.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L7.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L8.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.Arches.L9.Default.TextLabel.BackgroundColor3 = script.Parent.Parent.Red.Value
script.Parent.Parent.StageLight.Default.Color = script.Parent.Parent.Red.Value
script.Parent.Parent.Fail:Play()
script.Parent.Parent.Audio:Stop()
wait(5)
script.Parent.Parent.StageLight.Default.Color = script.Parent.Parent.White.Value
end


end
script.Parent.ClickDetector.MouseClick:connect(onClick)
Report Abuse
EntityXF is not online. EntityXF
Joined: 25 Mar 2009
Total Posts: 370
24 Jul 2015 10:26 PM
Thank you so much!


☃
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