Im trying to make all the parts invisible which are called "Part" how would i do this?
part = script.Parent.Part
while true do
wait(5)
part.Transparency = 1
end
Im trying to make all the parts invisible which are called "Part" how would i do this?
part = script.Parent.Part
while true do
wait(5)
part.Transparency = 1
end
Use a for loop, this will loop through all the children of a certain object and check for anything with a specific name you are looking for, like this:
for i,v in pairs(game.Workspace:GetChildren()) do -- Loops through all the children of the workspace, you can change this if needed.
if v:IsA("Part") and v.Name == "Part" then -- Checks to see if the item(v) is a part and have the name of part.
v.Transparency = 1
end
end
That's pretty much it.
I suggest using In pairs loop to does this as this illiterate through Objects or Models.
local Model = script.Parent--Location of your Model or Object here.
for _,v in pairs(Model:GetChilren()) do--GetChildren() gets all the Children inside the given Object, Clues in the Name.
if v.Name == "Part" then--Check if the Children's Name is equal to "Part"
v.Transparency = 1
end
end
~UserOnly20Charcters, Hoped I helped you to answer your question! If you have any further question, don't hesitate to comment below!!
This discussion is preserved as it was. New answers, comments, and votes are closed.