I am currently working on a stage that has lights all over it. There are 9 ClickDetectors that'll change the colors of these parts. Right now, the script works, but only for 1 part. I am looking for a way to use one script to change all 36 part colors at the same time.
My current script:
local variable = script.Parent:WaitForChild("ClickDetector") MDST = game.Workspace.MDST.SL1
variable.MouseClick:Connect(function() MDST.BrickColor = BrickColor.new("Really red") end)
The part "SL1" goes up to "SL36". Should I name all of them different or keep them named the same? I've tried adding more parts to it (i.e "game.Workspace.MDST.SL1.SL2.SL3.etc) but it doesn't work. Then, I tried c/p "MDST = game.Workspace.MDST.etc" to add another part in, but it still only changes one part. Please drop down suggestions of ways to fix this, thanks!
After removing eveything that you do not want the change the color from the model use this:
script.Parent.ClickDetector.MouseClick:Connect(function() local bricks = game.Workspace.MDST:GetChildren() --Creates a table with every single part inside of the model for i=1, #bricks do --creates a loop that will touch every single part inside of the table bricks[i].BrickColor = BrickColor.new("Really red") --changes the parts color to really red end end)