I am trying to make an ai follow you, then stop if it gets to close. but for some reason it works when i do mag >= 4 and doesn't work when i do mag <= 4 (which is what i am trying to do)
function killhuman()
for i,v in pairs(game.Workspace:GetChildren()) do
if v:FindFirstChild("Humanoid") then
local mag = (v.Head.Position - script.Parent.Head.Position).magnitude
local human = script.Parent.Humanoid
if mag >= 4 then
print("Too Close")
end
if mag <= 10 then
human:MoveTo(v.Head.Position)
end
end
end
end
while wait() do
killhuman()
end

2 comments
According to the wiki, MoveTo isn't deprecated
deprecated means that it is gonna get removed. It is removed.