#im new to roblox studio and i need help to make a button system where when you click all buttons it

30 messages · Page 1 of 1 (latest)

gusty loom
#

you want 1 script to control every button? your title got cut off

ebon fiber
#

nono

ebon fiber
#

with a click detecter

gusty loom
#

oh thats not too bad

ebon fiber
#

You think you can help?

tall stirrupBOT
#

studio** You are now Level 1! **studio

gusty loom
#

basically what you need to do is store all of the buttons in a table and keep track of whether or not they have been pressed using another table.

gusty loom
#

also my bad it doesnt ened 2 tables, just 1 dictionary

#

an instance can be used as a key to a table, that is important

#
local buttons = {}
local buttonsPressed = {}

local function AreAllDown()
  for _, pressed in buttonsPressed do
    if not pressed then
      return false
    end
  end
  return true
end

for _, button in buttons do
  buttonsPressed[button] = false
  button.MouseButton1Click:Connect(function()
    buttonsPressed[button] = true
    if AreAllDown() then
      print("All buttons are pressed, open door")
    else
      print("Not all buttons are pressed, dont open door")
    end
  end)
end
tall stirrupBOT
#

studio** You are now Level 2! **studio

gusty loom
#

also the MouseButton1Click part might be off, try to replace it with the correct one. I cant remember the name of it off the top of my head

ebon fiber
#

Alright

#

So just put this in all the buttons?

gusty loom
#

no no no

#

store a reference to each button in the "buttons" table

ebon fiber
#

Can you show me where it is sorry im new to this stuff

gusty loom
#

wdym show you where it is?

ebon fiber
#

like what do to store the script?

gusty loom
#

do you know what referencing is?

ebon fiber
#

No i do not

gusty loom
#

ok

#

a reference is basically the direction to a certain place in memory, think of it as being a houses' address but not the house itself

#

to get a reference, you use the . symbol between different phrases, I'm sure you've seen that before

#

it goes like this:

game.Players

or:

game.workspace

or:

workspace.Part
#

and there are many others

ebon fiber
#

mhm

gusty loom
#

you can also do:

workspace.Part.Color

to get the part's color