How do I stop NPCs from stacking onto your head / their heads?

Yeah. No idea how to fix this.

You should make a CollisionGroup for the NPCs

Are they being spawned on top of each other?
You could get them to walk in a direction immediately after they spawn, and leave a short delay between them spawning.
Another fix would be to spawn them at random points within a 10 stud square, or whatever size works for you.

No. NPCs spawn from a greater distance and in randomized vector3s, So they dont end up stacking on top of each other. When they get to the enemy (this building for instance) they will start stacking.

How can I do that? I’ve tried collision groups once before, but it ended up working weirdly.

Nevermind I am silly billy. Hhaa

Collision Filtering | Roblox Creator Documentation has a section about Disabling Character Collisions at the bottom.
This will keep Humanoids from colliding with each other, but if you still want them to group around and collide with each other then read up on the section of Humanoid.Climbing that tells you to disable climbing with Humanoid:SetStateEnabled.

2 Likes

ServerScriptService

local PhysicsService = game:GetService("PhysicsService")

PhysicsService:RegisterCollisionGroup("NPCs")

Script inside npc model

for _, v in pairs(script.Parent:GetChildren()) do
    if v:IsA("BasePart") or v:IsA("UnionOperation") then
        v.CollisionGroup = "NPCs"
end

The climbing thing works really good, thanks.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.