I'm trying to find all the children of some folders and change their Transparency and CanColide depending on a variable.
✓ ANSWER ACCEPTED
How would I change the Transparency and CanColide of multiple parts? (With Scripts)
2 answers
✓ Accepted answer
local descendants = game.Workspace:GetDescendants()--Change the game.workspace to your model.
for index, descendant in pairs(descendants) do
if descendant:IsA("Part") then
descendant.CanCollide = false
descendant.Transparency = 0.4
end
end
Using descendants you can basically get all the Parts/children in the model to modify.
local parts = game.workspace.Model:GetChildren() -- change to your model
if parts.CanCollide == true or parts.Transparency == 0 then
game.workspace.Model.WaitForChild()
parts.CanCollide = false
parts.Transparency = 1
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Tables