Here's my code. I'd like to take this and instead make MyTarget the nearest player instead of a random one. This will ensure the enemy targets a Survivor and not somebody who has already died. I have no idea how to do this.
local humansFound = {} local players = game.Players:children() if (#players < 1) then return end local i = math.random(1, #players) myTarget = players[i].Character
Any help is greatly appreciated! Thanks!