Preventing Humanoid NPCS going on your head

Basically I move my basic NPCS by a while loop with a :MoveTo(). I move my actual npcs with pathfinding and it’s more advanced, but just a basic version causes this to. I know this isn’t a problem which scripting it’s more of a physics thing. So how would I prevent this annoying thing?

https://gyazo.com/e29819d6a7604277b73af20fcdaa7ae2

Things I tried include setting all the parts of the zombie to massless, this made the zombies to light though and a simple push would make them fall.

2 Likes

Are you moving to the Head or the HumanoidRootPart?

I don’t really know, i’m just using Humanoid:MoveTo() which changes the WalkToPoint property of an humanoid, I don’t know what happens internally.

What’s the position you’re inputting in :MoveTo()?

Just the HumanoidRootPart’s position of the character (the target basically)

Alternatively, you could just disable collision between them.

That look’s pretty weird I don’t really want zombies going inside players, I already tried that using PhysicsService.

I’m not sure if the same solution could apply here, but when I had NPCs I didn’t want to be shoved around by the player, I enabled CustomPhysicalProperties and set Density to 100.

You could also try disabling the Climbing state.

Alright let me try that. I’ll tell you how it goes.

Disabling climbing made it better, but when I made the density of the HumanoidRootPart of the Zombie 100 it made it worse, and when I made the density 100 on all of the zombies parts it flinged me from the map.

The thing still happens though the zombies going on your head.

check the distance by the players head and the zombies head or hrp [humanoidrootpart]

here is some example

local Dis = (target.Head.Position - Zombie.HumanoidRootPart.Position).Magnitude

if Dis < YOUR_MAXIMUM_NUMBER_FOR_DISTANCE then
    -- move them
end

Move them where though back to the humanoidrootpart position? My zombies already are continously moving to the humanoidrootposition

move them back by the x axis and y axis

a position like this should work

CFrame.new(target.Head.CFrame - 5,0,0)

I’ll try that, I’ll tell you how it goes.

Well that fixes a lot of the cases, but there are still some cases where this still happens for example walking up ramps and the character jumping excessively on other zombies, any ways to prevent those?

do the same for the zombies etc etc.

Uh this is what I am doing for zombies. I’m running that code for zombies.

well you can always put a script in the zombies head and code a touched event with the magnitude i told you earlier

if that was the solution then mark it thanks!

This runs in a loop, there’s no need for a touched event. Magnitude checks replace the need of a touched event. Since the code is running in a loop it’s constantly doing magnitude checks making there be no need for a touched event.

so did you do the same for the other parts of your needs?