How To Change Multiple Parts' Colors with a click of a button (part)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to be able to click a button and my “buzzers” will reset color from Really Red to Dark Stone Grey.
    image

  2. What is the issue? Include screenshots / videos if possible!
    I cannot find anywhere that has this issue and a script to solve it. I have never scripted in the past legitimately and I’m under-experienced to do this.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I cannot find a post with this issue. I tried to use Bing AI (normally it has some good solutions) but every time I ran into some sort of issue in some sort of way. This was my last resort.

The parts that change color are named TableX11, TableX12, TableX21, TableX22, TableX31, TableX32, TableX41, TableX42, OverheadX11, OverheadX12, OverheadX21, OverheadX22, OverheadX31, OverheadX32, OverheadX41, and OverheadX42. This is for a talent show. Can anyone please help me??

1 Like

You would put all of the objects in a table, and do this:

local table = {
 Here goes every part
}

local function onClick()
for _, table in pairs(table) do
table.BrickColor = Enum.BrickColor.DarkStoneGrey (not sure if that’s the colour)
end
end

button.Activated:Connect(onClick)

Or something like that

Didn’t seem to work. Sorry. Thanks for atleast replying though!

It’s not a full script, we aren’t allowed to write entire scripts for you, you need to a flat it, or wait till tomorrow, I’ll probably be a belt o give you the full script in a DM

1 Like

sighhhhhh Please do. I really don’t like this no full scripts thing…

1 Like

put a ClickDetector with a script inside the button:
image

now you can basically do what dede wrote.

local clickDetector = script.Parent
local parts = {
	--put all the parts here, e.g.
	--workspace.TableX11, 
	--workspace.TableX12, 
	--etc.
}

local function onClick()
	for _,part in pairs(parts) do
		part.BrickColor = BrickColor.new("Dark stone grey")
	end
end

clickDetector.MouseClick:Connect(onClick)
3 Likes

It worked!! Thank you so much!!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.