Hey, Roblox Developer Community! I’m currently creating my first video game and I wanted to ask for some help on creating a multiple button system. The Goal of the script is for the server to detect when all three buttons are pressed, a bridge would be created inside the client. Here is the model I have created as an example.
As you can see, if only one button is pressed, the bridge will appear. However, I want my script to make it so that only if all three of the buttons are pressed, then the bridge will appear. I’m unsure of how to script this, So I’m reaching out for some assistance.
What I’d do is, make a Value inside each button.
As soon as one Button is touched it’ll set the value to true and check if the other buttons have their value as true, if they do then it’ll do the Bridge, if they don’t then nothing will happen.
Haven’t been able to checkout the file so sorry if this is unneeded information!
You could also achieve the same result with just a variable in the script itself.
local buttonPresses = 0
--code which handles a button press
buttonPresses += 1
if buttonPresses == 3 then
--all 3 buttons pressed
else --not all buttons pressed
--do stuff
end