AI keeps backing up and going towards the NPC with nothing changing at all. (red part is damage brick) What’s wrong?
-- i think the issue might be here
function backUp(target)
hum:Move(-(target.Position - head.Position).Unit)
end
function main()
local target = findTarget()
if target then
if getDistance(target) > backUpDistance then -- yet another check to see if we're too close
pathToTarget(target)
elseif getDistance(target) < 5.1 then
backUp(target)
elseif getDistance(target) > backUpDistance and not canSee(target) then
pathToTarget(target)
elseif getDistance(target) > 6 and getDistance(target) < 8 then
attack(target)
end
else
explore()
end
end
while wait() do
if hum.Health > 0 then
main()
else
break
end
end