Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
Edited 6 years ago

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

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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
0
Ah, okay... Thanks. WillContinues 20 — 6y
0
You're most welcome! User#18043 95 — 6y
Ad

Answer this question