I am trying too make a function which will check for player that is closest to the zombie. The script is inside the zombie but it returns nil for every player without player 1.
local torso = script.Parent.Torso
function getClose()
local ptorso = game.Players:GetChildren()
for i = 1, #ptorso do
local ptab = {
(torso.Position-ptorso[i].Character.Torso.Position).magnitude;
}
print(ptorso[i].Name,ptab[i])
end
end
