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.
Try this
Creating a folder in workspace
named ET then
script.Parent.MouseButton1Click:Connect(function() local folder = workspace.ET for _,v in pairs(folder:GetChildren()) do if v:IsA("Part") or v:IsA("BasePart") then v.Transparency = .3 end end end)
You can just check the names of every part in workspace to see if their name is "ET" and that they are a basepart, if so, you make it transparent
for _,v in next,workspace:GetDescendants() do if v.Name == "ET" and v:IsA("BasePart") then v.Transparency = 1 end end
well this method certainly works for the lazy,I would recommend making a folder for all things named ET and loop through that folder
for _,v in next,workspace.ETs:GetChildren() do if v:IsA("BasePart") then v.Transparency = 1 end end