Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to target bricks with a certain material?

Asked by 3 years ago
Edited 3 years ago

I'm working on an if statement that if the descendants is a brick and its material is neon, it changes their color. I'm using IsA to do this, but I'm not familiar with it.

Could someone help me with how I should write it?

1 answer

Log in to vote
0
Answered by
VAHMPIN 277 Moderation Voter
3 years ago
Edited 3 years ago

this should work.

for i,v in pairs(workspace:GetDescendants()) do
      if v.Material == Enum.Material.Neon then
-- script
   end
end

  • also change color
for i,v in pairs(workspace:GetDescendants()) do
      if v.Material == Enum.Material.Neon then
           v.Color3 = Color3.fromRGB(255,0,0)
   end
end

0
Thank you so much! g_captain 17 — 3y
0
no problem :D VAHMPIN 277 — 3y
Ad

Answer this question