1 | for index, child in pairs (wendigoParts) do |
2 | print (child.Name) |
3 | if child.CanCollide then |
4 | print (child.Name, " Can Collide" ) |
5 | PhysicsService:SetPartCollisionGroup(child, wendigoGroup) |
6 | end |
7 | end |
The script is always stopping on the
1 | if child.CanCollide then |
It is stopping when it runs into something that does not have the CanCollide inside of it. I thought the if CanCollide ment if it has the CanCollide feature the next line runs?
Try this code:
1 | for index, child in pairs (wendigoParts) do |
2 | print (child.Name) |
3 | if child:IsA( "BasePart" ) and child.CanCollide then |
4 | print (child.Name, " Can Collide" ) |
5 | PhysicsService:SetPartCollisionGroup(child, wendigoGroup) |
6 | end |
7 | end |
Changes that I made:
(Thanks to @NathanTheDeveloper): Tested to see if child
was a BasePart
and if it had true
for CanCollide