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

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

Asked by 4 years ago
Edited 4 years ago

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

0
Tables ryan32t 306 — 4y

Closed as Not Constructive by hiimgoodpack and VitroxVox

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 4 years ago
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.

Ad
Log in to vote
0
Answered by
raid6n 2196 Moderation Voter Community Moderator
4 years ago
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