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 4 years ago
Edited 4 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
4 years ago
Edited 4 years ago

this should work.

1for i,v in pairs(workspace:GetDescendants()) do
2      if v.Material == Enum.Material.Neon then
3-- script
4   end
5end
  • also change color
1for i,v in pairs(workspace:GetDescendants()) do
2      if v.Material == Enum.Material.Neon then
3           v.Color3 = Color3.fromRGB(255,0,0)
4   end
5end
0
Thank you so much! g_captain 17 — 4y
0
no problem :D VAHMPIN 277 — 4y
Ad

Answer this question