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

How do you make all parts make invisible but not 1 in a model ?

Asked by
Bulvyte 388 Moderation Voter
8 years ago

I got a tycoon button that on press it gets rid of it puts the model into removedobjects BUT! makes only 1 part invisible and cancollide other parts stay there. i don't need any functions or anything just an example how to make ALL parts invisible in the model

object.Part.Transparency = 1 -- < makes 1 part invisible, when i want all parts in the model to be INVISIBLE!
object.Part.CanCollide = false -- same here like in 1st line

Don't make that it destroyes the object because i need it to be invisible, thank you all!

1 answer

Log in to vote
1
Answered by 8 years ago

I suggest using In pairs loop, as its loop through all the Children inside the given object

local Model = game.Workspace:FindFirstChild("Model")--Replace Model with your Model name.
for _, v in pairs (Model:GetChildren()) do--This Gets all the Children inside your Model and loops through them.
    if v:IsA("Part") then--Check is the Children inside the Model has a ClassName of Part.
    v.Transparency = 1--If its ClassName is a Part then Transparency will change to 0
    v.CanCollide = false-- Change the Children's CanCollide to false.
    end
end

If you want to know more about Pairs loops

0
thanks, but i got more questions, can you please check your roblox inbox ? Bulvyte 388 — 8y
0
Sure, Edited: What question do you have? UserOnly20Characters 890 — 8y
Ad

Answer this question