I have a part that I want the npc to collide with and the player to be able to go through it, but I’m not exactly sure if I’m using collision groups correctly or I have an issue because it is not working, does anyone know the issue?
Code:
local npc = game.Workspace.Spider
local ps = game:GetService("PhysicsService")
local safezoneGroup = script.Parent
ps:RegisterCollisionGroup("NPCGroup")
ps:RegisterCollisionGroup("SafezoneGroup")
ps:CollisionGroupSetCollidable("NPCGroup", "SafezoneGroup", true)
for i, v in npc:GetChildren() do
if not v:IsA("BasePart") then continue end
v.CollisionGroup = "NPCGroup"
end
safezoneGroup.CollisionGroup = "SafezoneGroup"