while true do
wait(0.1)
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~=nil then
if target.Parent.Name ~= script.Parent.Owner.Value then
script.Parent.Zombie:MoveTo(target.Position, target)
end
end
end
This is part of a Zombie script. I made this script work so that it won't attack the closest player if it's the creator of the zombie. It works well except that it doesn't work the way I need it to and I don't know how to fix it.
Basically, it always locks on the check if the closest player is the owner, and if the closest player is the owner it doesn't attack it. It'll only attack another player as long as that player is closer than the owner. I'd like to fix it so that it'll go for the second closest player if the closest player is the owner. Can someone help me fix it so that it does what it needs to do?

1 comment
Can you provide your findNearestTorso function's sourcecode, please?