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

What's the new way to move an NPC? [Solved]

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?

1 answer

✓ Accepted answer

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

2 comments

0

Ah, okay... Thanks.

0

You're most welcome!

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