Simple way to disable cancollide with npcs?

I’m trying to make it so that an npc can’t collide with the player or any other npcs, how would I go about this with the most efficient method?

1 Like

You could make every part of them CanCollide false? Would solve the issue. Another method is Collision Groups but the former is easier.

1 Like

Tried something like this and it didn’t work :confused: Is there something wrong with this?

		for _, part in pairs(playermodel:GetDescendants()) do
			if part:IsA("Part") or part:IsA("BasePart") then
				part.CanCollide = false
			end
		end

Then I suggest using PhysicsService.

In which you’ll read about Collision Groups.
Handy article about Collision Filtering.

1 Like

Okay, I’ve looked into it but I’m not quite sure how to get the n.pc to be part of the collision group correctly. I keep getting errors saying that parameter of SetPartCollisionGroup needs to be a BasePart.

You need to create a CollisionGroup with :CreateCollisionGroup, and then add every Part/BasePart of your NPC to it using :SetPartCollisionGroup.

There’s an example provided on Collision Filtering.