Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Click Detector Disable for 1 minute?

Asked by
turf23 0
9 years ago

Hi there scripters out there i was wondering how to add a function when on click it immdiatly disbles the button for 1 minute before renableing it to be clicked the command should go right under sound play i need it for both thanks

function ToggleLight()

if script.Parent.ClickDetector.MaxActivationDistance == 15 then
script.Parent.OpenSound:play()
script.Parent.BrickColor = BrickColor.new("Bright red") 
game.Workspace.lockdowndoor1.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor1.Script.Disabled = false
wait(20)
game.Workspace.lockdowndoor2.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor2.Script.Disabled = false
wait(20)
game.Workspace.lockdowndoor3.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor3.Script.Disabled = false
wait(20)
game.Workspace.lockdowndoor4.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor4.Script.Disabled = false
wait(20)

script.Parent.ClickDetector.MaxActivationDistance = 15

 else


script.Parent.OpenSound:play()
script.Parent.BrickColor = BrickColor.new("Yellow") 
game.Workspace.lockdowndoor1.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor1.Script.Disabled = false
wait(20)
game.Workspace.lockdowndoor2.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor2.Script.Disabled = false
wait(20)
game.Workspace.lockdowndoor3.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor3.Script.Disabled = false
wait(20)
game.Workspace.lockdowndoor4.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor4.Script.Disabled = false
wait(20)

script.Parent.ClickDetector.MaxActivationDistance = 15
end
end

script.Parent.ClickDetector.MouseClick:connect(ToggleLight)
0
Please put in code block. EzraNehemiah_TF2 3552 — 9y
0
Code block please! yumtaste 476 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

Because your script is not in code block and is hard to read, just add this into your script:

script.Parent.ClickDetector.MaxActivationDistance = 0
wait(60) --Wait a min
script.Parent.ClickDetector.MaxActivationDistance = 15

Pretty simple. I can't explain it now because it's pretty late. Basically it's just making the ClickDetector unclickable.



EDIT

You added a code block:

function ToggleLight()

if script.Parent.ClickDetector.MaxActivationDistance == 15 then
script.Parent.ClickDetector.MaxActivationDistance = 0 --Prevent clicking, it does it right after the player clicks.
script.Parent.OpenSound:play()
game.Workspace.lockdowndoor1.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor1.Script.Disabled = false
wait(20)
game.Workspace.lockdowndoor2.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor2.Script.Disabled = false
wait(20)
game.Workspace.lockdowndoor3.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor3.Script.Disabled = false
wait(20)
game.Workspace.lockdowndoor4.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor4.Script.Disabled = false
wait(20)

 else


script.Parent.OpenSound:play()
game.Workspace.lockdowndoor1.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor1.Script.Disabled = false
wait(20)
game.Workspace.lockdowndoor2.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor2.Script.Disabled = false
wait(20)
game.Workspace.lockdowndoor3.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor3.Script.Disabled = false
wait(20)
game.Workspace.lockdowndoor4.Script.Disabled = true
wait(.1)
game.Workspace.lockdowndoor4.Script.Disabled = false
wait(20)
script.Parent.ClickDetector.MaxActivationDistance = 15
end
end

script.Parent.ClickDetector.MouseClick:connect(ToggleLight)
0
well it needs to be diable right away cause if its not and people click kit again the lockdown doors will be messed up and go where they arnt suppose to go turf23 0 — 9y
Ad
Log in to vote
0
Answered by
turf23 0
9 years ago

i added a code block

Answer this question