The default Roblox drooling zombie should already have an ignore list for the other zombies.
CanSeeTarget.Evaluate = function()
if model then
-- Get list of all nearby Zombies and non-Zombie humanoids
-- Zombie list is used to ignore zombies during later raycast
local humanoids = HumanoidList:GetCurrent()
local zombies = {}
local characters = {}
for _, object in pairs(humanoids) do
if object and object.Parent and object.Parent:FindFirstChild("HumanoidRootPart") and object.Health > 0 and object.WalkSpeed > 0 then
local torso = object.Parent:FindFirstChild("HumanoidRootPart")
if torso then
local distance = (model.HumanoidRootPart.Position - torso.Position).magnitude
if distance <= configs["AggroRange"] then
if object.Parent.Name == "Drooling Zombie" then
table.insert(zombies, object.Parent)
else
table.insert(characters, object.Parent)
end
end
end
end
end
local target = AIUtilities:GetClosestVisibleTarget(model, characters, zombies, configs["FieldOfView"])
if target then
ZombieTarget = target
return true
end
function utility:GetClosestVisibleTarget(npcModel, characters, ignoreList, fieldOfView)
local closestTarget = nil
local closestDistance = math.huge
for _, character in pairs(characters) do
local toTarget = character.HumanoidRootPart.Position - npcModel.HumanoidRootPart.Position
local toTargetWedge = toTarget * Vector3.new(1,0,1)
local angle = math.acos(toTargetWedge:Dot(npcModel.HumanoidRootPart.CFrame.lookVector)/toTargetWedge.magnitude)
if math.deg(angle) < fieldOfView then
local targetRay = Ray.new(npcModel.HumanoidRootPart.Position, toTarget)
local part, position = game.Workspace:FindPartOnRayWithIgnoreList(targetRay, ignoreList)
if part and part.Parent == character then
if toTarget.magnitude < closestDistance then
closestTarget = character
closestDistance = toTarget.magnitude
end
end
end
end
return closestTarget
end
I don’t understand what the problem is. Are you sure you’re using the same zombies? Did the ones you pick have the badge by their thumbnail?
Oh ok well when the script detects whether the target is a humanoid, just add: and not target.Parent.Name == “Zombie”
This will check whether to make sure the target part is not parented to a zombie.
Are you sure that you are using the right Drooling Zombie free model? Because I used this Free Model for Drooling Zombies, and they are not attacking each others.
This here solved it for me. If your using the “Drooling Zombie” from Roblox Themselves, in your module scripts check for HumanoidList and replace this on line 10:
“if object:IsA(“Humanoid”) and object.Parent.Name ~= “Zombie” then”