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

How would I change the Transparency and CanColide of multiple parts? (With Scripts)

I'm trying to find all the children of some folders and change their Transparency and CanColide depending on a variable.

1 comment

0

Tables

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.