Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

2 comments

0

thanks, but i got more questions, can you please check your roblox inbox ?

0

Sure, Edited: What question do you have?

This discussion is preserved as it was. New answers, comments, and votes are closed.