I'm trying to create a button whereupon being clicked, changes the transparency of multiple parts with the same values but it won't work, I'm not that great with scripting so i don't really know what I'm doing wrong
local Button = workspace.LightButton1 -- where the button is located local Lights = workspace.Row1:GetChildren() -- where multiple lights are located (in a group) Button.MouseButton1Down:Connect(function() if Lights.Transparency == 0 then Lights.Transparency = 1 elseif Lights.Transparency == 1 then Lights.Transparency = 0 end end)
You need to switch each transparency property seperately. Fortunately you can easily do this with a for loop.
Button.MouseButton1Down:Connect(function() for i, v in ipairs (workspace.Row1:GetChildren()) do if v.Transparency == 0 then v.Transparency = 1 elseif v.Transparency == 1 then v.Transparency = 0 end end end)