Well, I want you to be able to search for objects by their name with GetChildren so that if they have a defined name, the function is done with the objects that have that name, for example:
local Model = game.Workspace.Folder:GetChildren()
for i, child in ipairs(Model) do
if child:IsA("BasePart") then
child:WaitForChild("Model"):WaitForChild("Part").Material = Enum.Material.Wood
end
end
In this I put that all the children called “Part”, change the subject to wood, but it does not work
You could simply compare the Child’s Name property and run some code depending on the results. Here’s what it would look like:
local Model = game.Workspace.Folder:GetChildren()
for i, child in ipairs(Model) do
if child:IsA("BasePart") and child.Name == "Part" then -- Change "Part" to the name which will trigger the line below
child:WaitForChild("Model"):WaitForChild("Part").Material = Enum.Material.Wood
end
end
Another possible issue could be child:IsA("BasePart"). Try removing that and check if it works, you might get different results if you are looking to change objects which are not of that class.