How to change lots of brick properties with a script

In my obby game, there are a lot of neon bricks. I want to change the transparency, but there are too many so I’m really lazy to change one by one. Is there any way to change it with a script?

NOTE: The neon bricks are not in one folder.

you can check workspace for all parts which are neon

for i,neonpart in pairs(workspace:GetDescendants) do
    if neonpart:IsA("Part") and neonpart.Material == Enum.Material.Neon then
        --Change all neon parts properties here
    end
end
2 Likes

Thank you it works! I have learned something new today! I did not know GetDescendants was a thing!

1 Like

Say if you used that script, ethairo, would you be able to undo it somehow? Or nah?

Since this is a few months old, I’ll chime in. Yes @f1ourish_d you can simply simulate “undoing” the properties by using the same method, but do the reverse effects. If you just wanted to switch transparency from visible to invisible, and vice versa, for example you’d just do this:

for i,neonpart in pairs(workspace:GetDescendants) do
    if neonpart:IsA("Part") and neonpart.Material == Enum.Material.Neon then
        neonpart.Transparency = 1 -- Makes part(s) invisible
    end
end

-- Undo the above effects with this:
for i,neonpart in pairs(workspace:GetDescendants) do
    if neonpart:IsA("Part") and neonpart.Material == Enum.Material.Neon then
        neonpart.Transparency = 0 -- Makes part(s) visible again
    end
end
1 Like