Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with Artificial Intelligence?

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

1 answer

: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.

2 comments

0

According to the wiki, MoveTo isn't deprecated

0

deprecated means that it is gonna get removed. It is removed.

This discussion is preserved as it was. New answers, comments, and votes are closed.