I am making a script so it checks if a certain model parts inside are cancollide or not. Please help me figure out how to write a script checking if the model children are cancollide or not.
COMMUNITY QUESTION
Simple scripting questions involving getting a model children and checking the properties?
2 answers
Isn't it something like ...
CHILDREN = InsertIndexOfModelHere:GetChildren() --replace InsertIndexOfModelHere with the path to index your model (like script.Parent)
for _, v in pairs (CHILDREN) do
if v:IsA("BasePart") then
if v.CanCollide == false then
print(v.Name.."Is not CanCollide")
else
print(v.Name.."IS CANCOLLIDE WOOHOO")
end
end
end
Basically what I did here was take the model and use the GetChildren() method to assign all children to the variable CHILDREN in a table.
Then, using a for loop, for every value, I checked if it was a solid Part, and if that Part was cancollide
Then, I printed whether it was or was not.
One second.
This discussion is preserved as it was. New answers, comments, and votes are closed.
