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
:MoveTo() is not a method anymore. It is movetopart or movetocframe I believe. I think it even shows you the methods name in the properties of the Humanoid element.