Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to make a script that will make all parts of a model be transparent ?

Asked by 4 years ago

Hello Everyone , I have a problem i want to make a script that will make all parts of my model Named "TransparentWindows" be Transparent when i push a button. The button part is not problem but how do i get all the parts of a model in a script ?

Thank you Forward.

(Sorry there isnt a script because i coudlnt manage to make one)

0
I recommend using ":GetDescendants()" to get absolutely all the instances in the model. ryan32t 306 — 4y

1 answer

Log in to vote
4
Answered by 4 years ago

You can get all child inside the model using :GetChildren() function, this will return a table with all the children in it , you can then put it inside a variable example :

local childs = workspace.Model:GetChildren()

and then you can loop through them using a for loop example :

local childs = workspace.Model:GetChildren()
for i, v in pairs(childs) do
    print(v.Name)
end

then you can check if the child is a part using if example :

local childs = workspace.Model:GetChildren()
for i, v in pairs(childs) do
    if v:IsA("BasePart") then
        print(v.. "Is a part!")
    end
end
0
This is proqrammed 285 — 4y
0
*This answer is very well explained. Helped with my game. proqrammed 285 — 4y
Ad

Answer this question