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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 24 Jul 2015 10:03 PM |
| Gosh that's so inefficient code |
|
|
| Report Abuse |
|
|
EntityXF
|
  |
| Joined: 25 Mar 2009 |
| Total Posts: 370 |
|
|
| 24 Jul 2015 10:04 PM |
But it does the trick, lol
☃ |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 24 Jul 2015 10:19 PM |
INEFFICENT ALERT...
OMG LAG WILL BE SO INSANE |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| Joined: 25 Mar 2009 |
| Total Posts: 370 |
|
| |
|