I was messing around with NPCs and stumbled on to an old post saying to use MoveTo for moving NPCs. It broke. I didn't realize it until now.
humanoid = script.Parent part1 = game.Workspace.p1 part2 = game.Workspace.p2 while true do wait(3) humanoid:MoveTo(part2.Position, part2) wait(3) humanoid:MoveTo(part1.Position, part1) end
What's the new way to do this?
There isn't a new way, you're using it wrong.
:MoveTo()
generally only needs one parameter, where the humanoid needs to go to. Also, :MoveTo()
only accepts Vector3 values not objects. So only set the .Position
of a object not the object itself.
humanoid = script.Parent part1 = game.Workspace.p1 part2 = game.Workspace.p2 while true do wait(3) humanoid:MoveTo(part2.Position) wait(3) humanoid:MoveTo(part1.Position) end