Preventing Humanoid NPCS going on your head

Not sure what you mean, but in my game I only have zombies, which are stored in a table and looped though using a task schedular system I made. So if I change it once I don’t need to make it for every single zombie, since they run on the same code.

what do you need then? be more specific about it

A way to prevent zombies from going on player heads due to physics. I know why this happpens it’s because the zombie goes to the player’s root position, which is further then the zombie can go since positions are calculated by the part’s middle. Making the zombie pushing the player to get to that position, which sometimes makes the zombie go on top of the player due to physics.

To prevent this I just figured a way i’ll let you know if it works, by making the target go exactly to the front point of the humanoidrootpart based on the direction the zombie is away from the root.

1 Like

perhaps?

direction = (target.Position-start.Position).Unit
distance = (target.Position-start.Position).Magnitude
moveDistance = distance-(a suitable distance away from a target player that allows attacking, eg 3 studs?)
moveTo = start.Position + (moveDistance*direction)
3 Likes

Not to bump the topic, but I found the exact solution:

If the NPC is an R15, you have to set every part of the enemy in a non-collide collision group with the player EXCEPT the LowerTorso and the Head. This will prevent the NPC from being able to climb you and will instead just walk into you.

However, doing this will cause you to accidently climb the NPC when you walk into it, so to correct this, I just simply disabled Enum.HumanoidStateType.Climbing on my Character.

Doing these two things 100% fixed this issue for me.

4 Likes

Quick update: I found an even BETTER solution.

Literally just make a collidable hitbox on put it around the enemy.

2 Likes