Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Make NPC not collide with players?

Hey im currently making a walking npc and i really want to know how i disable the cancollide of the player. Everyone in my game is disturbing the movement of the NPC while he is walking. Is there a way that no one can disturb the NPC its movement?

Sincerly Nathan EggService The Netherlands

1 comment

0

create a collision group

1 answer

✓ Accepted answer

Hello! I found this earlier, its called Collision Filtering Try this maybe? I didn't test it, but I hope this worked. Also if this doesn't work, or no one can answer there is some other articals and stuff around the internet. Hopefully this helps.

local PhysicsService = game:GetService("PhysicsService")
npcGroup = "npcGroup"
PhysicsService:CreateCollisionGroup(npcGroup) 
PhysicsService:CollisionGroupSetCollidable(npcGroup, npcGroup, false) 
local function setCollisionGroupRecursive(object) 
    if object:IsA("BasePart") then 
        PhysicsService:SetPartCollisionGroup(object, npcGroup) 
    end
    for _, child in ipairs(object:GetChildren()) do 
        setCollisionGroupRecursive(child)
    end
end
npc = workspace.NPC
setCollisionGroupRecursive(npc)

This discussion is preserved as it was. New answers, comments, and votes are closed.