Group Collisions (HELP)

-I want to create a wall that will allow everything through (Players, Bricks, Tools, etc.) but I want it to block NPCs from going through.

-The problem is the wall needs to be set to collide for CollisionGroupSetCollidable to work.

-I tried turning off collide on the wall, and then setting the CollisionGroupSetCollidable to true but this hasn’t worked for me, any suggestions?


The CollisionGroupIDCreator in ServerScriptService


The script inside the wall


The script inside the zombie(NPC)

Collision groups aren’t the equivalent of CanCollide. If two collision groups are collidable, that just means physics works as normal (including CanCollide). If two collision groups are not collidable, then they ignore each other as if parts in either group are CanCollide=false.

For your case, you’d want to enable CanCollide on the wall, use the current collision groups you have for the zombie/wall, and then disable collisions between the default collision group (players, tools, parts, etc) and the wall:

physicsService:CollisionGroupSetCollidable("Wall", "Default", false)

2 Likes

Yess! I got it to work, thank you very much! :smile: