i have npcs that are in a collision group (named XMonsterNPCS) and i have parts that are in a collision group (PathModifiers) and im trying to make it so the NPCs can go through the parts.
however, the NPCs arent able to go through the parts
the PathModifiers collision group parts are meant to change how the NPC computes its path while the npc can still go through it.
this is my collision group layout:
this may not be needed, but this is a script im using:
local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")
local NPCS = workspace:WaitForChild("Animation")
PhysicsService:CreateCollisionGroup("Characters")
PhysicsService:CreateCollisionGroup("NPC")
PhysicsService:CreateCollisionGroup("NPC1")
PhysicsService:CreateCollisionGroup("NPCs")
PhysicsService:CollisionGroupSetCollidable("Characters", "Characters", false)
PhysicsService:CollisionGroupSetCollidable("Characters", "NPC", false)
PhysicsService:CollisionGroupSetCollidable("Characters", "NPC1", false)
PhysicsService:CollisionGroupSetCollidable("NPCs", "Characters", false)
local function onDescendantAdded(descendant)
-- Set collision group for any part descendant
if descendant:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(descendant, "Characters")
end
end
for i, v in pairs(NPCS:GetDescendants()) do
if v:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(v, "NPC")
PhysicsService:SetPartCollisionGroup(v, "NPC1")
PhysicsService:SetPartCollisionGroup(v, "NPCs")
end
end
local function onCharacterAdded(character)
-- Process existing and new descendants for physics setup
for _, descendant in pairs(character:GetDescendants()) do
onDescendantAdded(descendant)
end
character.DescendantAdded:Connect(onDescendantAdded)
end
Players.PlayerAdded:Connect(function(player)
-- Detect when the player's character is added
player.CharacterAdded:Connect(onCharacterAdded)
end)
yes i know its really messy