Okay please take note
--------------------Model
---------Brick
--------------Decal
---------Brick
--------------Decal
---------Brick
--------------Decal
---------Brick
-------------Decal
That is what my model looks like, I have this code
local orderboard = game.Workspace.ModelCollection:GetChildren() local ID = game.Workspace.ReferenceDecal.Texture for i, v in pairs(orderboard) do if v.Decal.Texture == ID then ---extra stuff goes here end end
I keep getting the error
Decal is not a valid member of Part
Why is this? Shouldn't the for loop be able to iterate things inside of the brick?
It seems like one of the Parts in ModelCollection doesn't have a Decal.
Check if the descendant has a decal, before attempting to index it.
local orderboard = workspace.ModelCollection:GetChildren() local ID = workspace.ReferenceDecal.Texture for i, v in pairs(orderboard) do local Decal = v:FindFirstChild("Decal") if Decal then --Check if it exists if Decal.Texture == ID then ---extra stuff goes here end end end