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?
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.
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)
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.
Quick update: I found an even BETTER solution.
Literally just make a collidable hitbox on put it around the enemy.