How to create zombie NPC that avoid colliding with eachothers

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a zombie NPC that can chase player by pathfinding and avoid colliding with eachother so they don’t look clumped too crowded like the game Guts And Blackpowder.

  1. What is the issue? Include screenshots / videos if possible!
    When the zombies start chasing player it formed a big blob of zombies and causing a lot of lag

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried welding a part called “Collider” to a zombie’s model then add pathfinding modifier to it.It kinda work, but it makes the zombies moving so jittery.

, I tried setting the zombie’s collision group to not collide with eacother, but it make the zombie clamped together. I want it to move away from eachother.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Here is the place file

ZombieEscape.rbxl (72.4 KB)

If you are trying to change the pathfinding logic, please go to ServerStorage>Zombie>Module>Pathfinding, sorry for the messy code I trying to learn how to use modulescript. I hope you can solve my problem. If you want to ask any question, feel free to comment on my post.

You could check if the model found is a player’s character by indexing through the players in the game.

Mb wrong answer, just use collision groups

Try looking into flocking behavior if you need them to physically avoid each other.

Otherwise, use collision groups to prevent them colliding with each other. Of course, you’ll have to edit the parameters in the pathfinding functionality if you’re using ROBLOX’s native pathfinding to make the zombies avoid pathfinding to each other.

I tried using it. It make the zombies clamp together. I want it to move away from eacother.

I’ve heard of it, but I’m not so expirenced in coding. If you can please show me how to do it, or at least send me a link to tutorial video/website, It would be apreciated.

I figured out how to make the zombies move away from eachother! I just need to add a repulsion force to the zombie’s humanoid root part. Just like the Roblox’s Drooling Zombie does.

1 Like

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