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)
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)