Explanation: Okay guys so I have two buttons inside of a Model and also an IntValue inside the Model that acts like a debounce for the progress. Whenever the button is pressed it sets the IntValue to 1 so that no other button can be pressed until the previous button pressed finishes everything it has to do.
Issue: For some reason if I press one button and let it run through, when I try to go press the second button nothing happens, even though the IntValue is set to 0. I have a feeling it is due to the "enabled = true" but even if they are separate scripts it should not interfere? Do I need to change the name enabled = true to something like enabled1 = true, enabled2 = true, etc for each script?
Button 1
open = true
self = script.Parent
enabled = true
inProgress = script.Parent.Parent.Value
function Click()
if enabled == true then
enabled = false
if inProgress.Value == 0 then
print("inprogress is 0")
inProgress.Value = 1
print("enabled == true now setting to false")
self.BrickColor = BrickColor.new("Bright red")
game.Workspace.Song:Play()
wait(36)
inProgress.Value = 0
wait(10) --Wait 10 seconds before being able to press again
self.BrickColor = BrickColor.new("Bright green")
enabled = true
end
end
end
script.Parent.ClickDetector.MouseClick:connect(Click)
Button 2
open = true
self = script.Parent
enabled = true
inProgress = script.Parent.Parent.Value
function Click()
if enabled == true then
enabled = false
if inProgress.Value == 0 then
print("inprogress is 0")
inProgress.Value = 1
print("enabled == true now setting to false")
self.BrickColor = BrickColor.new("Bright red")
game.Workspace.Landing:Play()
wait(24)
inProgress.Value = 0
wait(10) Wait 10 seconds before being able to press again
self.BrickColor = BrickColor.new("Bright green")
enabled = true
end
end
end
script.Parent.ClickDetector.MouseClick:connect(Click)

1 comment
Script 2, line 17, you forgot to add --before the note, maybe that is messing up your second script. Just try pressing the second first and see if it works.