Hello, in my game i am currently working on one of the main aspects is pushing buttons to progress, and whenever all buttons are pressed players have about a minute to get back to the elevator before it leaves
What i am trying to do here is constantly check if all buttons have been pressed with bool values so the game knows when to warn players that they have to get back to the elevator.
This is the code inside the button:
local buttonWav = script["button.wav"]
local buttonPress = script["Generator Button"]
local proxPrompt = script.Parent.ProximityPrompt
local light = script.Parent.PointLight
local button = script.Parent
local pressed = false
local debounce = true
button.ProximityPrompt.Triggered:Connect(function()
if debounce then
debounce = false
if not pressed then
buttonPress:Play()
proxPrompt.Enabled = false
wait(0.3)
light.Color = Color3.new(0.266667, 1, 0)
button.BrickColor = BrickColor.new("Lime green")
buttonWav:Play()
proxPrompt:Destroy()
end
pressed = true
end
end)
again, i’m just trying to make a script that checks constantly if all buttons are pressed. Thank you in advance