So instead of a part that has another parts BrickColor being CanCollide, all of the turn CanCollide off
print('Cube Switch - loaded')
local screen = script.Parent:WaitForChild('screen')
local colors = {}
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA('Part') then
if v.Name == 'screen' or v.Name == 'Bridgemain' or v.Name == 'area' then
continue
end
table.insert(colors, v.BrickColor)
end
end
while wait(5) do
local part_
local ran = math.random(1,9)
screen.BrickColor = colors[ran]
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name == 'screen' or v.Name == 'Bridgemain' or v.Name =='area' or v.Name == 'MinigameScript' then
continue
end
if v.BrickColor == screen.BrickColor then
part_ = v
end
end
for i,v in pairs(script.Parent:GetChildren()) do -- HERE!!!!!!
if v.Name == 'screen' or v.Name == 'Bridgemain' or v.Name =='area' or v.Name == 'MinigameScript' then
continue
end
if v.Name ~= part_ and part_ ~= nil then
v.CanCollide = false
v.Transparency = .88
end
end
wait(5)
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name == 'screen' or v.Name == 'Bridgemain' or v.Name =='area' or v.Name == 'MinigameScript' then
continue
end
v.CanCollide = true
v.Transparency = 0
end
end