I'm trying to figure out how to make all parts named "ET" in workspace transparent 0.3 when a text button gui, I used a onClick function for when the button was clicked i don't know if that's why or if its the code i got for selecting all parts from here.
this is my script:
local name = "ET"
function onClick()
local function Modify(part)
part.Transparency = 0.3 end
local function recursive(obj) for _, child in pairs(obj:GetChildren()) do if (child.Name == name) then Modify(child); end recursive(child); end end recursive(workspace);
end
I dont know what's wrong with it. If you can help I thank you very much.

3 comments
You can use :GetDescendants() instead of :GetChildren() as :GetDescendants() gets every single object in workspace, unlike :GetChildren() which only gets the ones directly parented to workspace.
^ no... Just GetDescendants.......... getChildren doesn't get all the children.
^ I think you misunderstood. I was trying to say that GetDescendants() gets everything, not both. I’ll reword my last comment to be more clear. Also, GetChildren() does kinda get all the children if you think about it.