Are you able to toggle the collision of an entire model through a script?
Can I use this line of code?
model.CanCollide = false
Please help!
Are you able to toggle the collision of an entire model through a script?
Can I use this line of code?
model.CanCollide = false
Please help!
Loop through it’s children and set CanCollide false for each part.
Like others have said, loop through the models contents and get the descendants. Check if the object is a part, and if it is, make it cancollide false.
Hope this helps!
Models dont have a CanCollide property, though you can loop through its children’s parts.
The way you would do this is to use the IsA function to check if the instance is part of the superclass BasePart, since all BasePart have a cancollide property.
for i, v in pairs(model:GetChildren() do
if v:IsA("BasePart") then
v.CanCollide = false
end
end)
Thanks! I guess I forgot that for loops existed
Quick question:
What’s the difference between a Part
and a BasePart
?