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

Npc path script not working? -(ANSWERED)

Asked by 10 years ago

Im trying to get my Npc to move from part to part but all he does is stand there?

print("Doge Moveing") -- Just to see if the script is running
    Part = game.Workspace.G.Position
    Part2 = game.Workspace.G1.Position
    Part3 = game.Workspace.G2.Position
while true do
    game.Workspace.Doge.Humaniod:MoveTo(Part)
    wait(15)
    game.Workspace.Doge.Humaniod:MoveTo(Part2)
    wait(15)
    game.Workspace.Doge.Humaniod:MoveTo(Part3)
    wait(15)
end
0
First off, you spelled Humanoid wrong. Second off, you can't use :MoveTo on a Humanoid, you use it on the Torso of the NPC. SlickPwner 534 — 10y

2 answers

Log in to vote
1
Answered by
Tkdriverx 514 Moderation Voter
10 years ago

Ok, first of all, the first answer is incorrect. Yes, you did misspell Humanoid. And based on your question, you want the character to walk to the location, right?

The fixes:

print("Doge Moving") -- Just to see if the script is running
Part = game.Workspace.G.Position
Part2 = game.Workspace.G1.Position
Part3 = game.Workspace.G2.Position

while true do
    game.Workspace.Doge.Humanoid:MoveTo(Part)
    wait(15)
    game.Workspace.Doge.Humanoid:MoveTo(Part2)
    wait(15)
    game.Workspace.Doge.Humanoid:MoveTo(Part3)
    wait(15)
end

A Humanoid's MoveTo method takes one argument and one optional argument (Vector3 location, Instance part = nil). The MoveTo method in Humanoids make the humanoid WALK to the location given.

I looked in the wiki. NOWHERE did I see that Parts have a :MoveTo method. This is why the others are wrong.

0
Thank you :D - Oh and i delete my post sense you edited Armoredtj 25 — 10y
Ad
Log in to vote
1
Answered by
Relatch 550 Moderation Voter
10 years ago

First off, there are a few things wrong with your script. 1. You spelled "Humanoid" wrong. 2. You don't use MoveTo() on a humanoid.

Fixes: You need to call MoveTo() on the torso, because humanoid doesn't use MoveTo() Removed humanoid because you don't use humanoid with MoveTo()

print("Doge Moving") --Fixed speling mistakes

part = game.Workspace.G.Position
part2 = game.Workspace.G1.Position
part3 = game.Workspace.G2.Position

while true do
    game.Workspace.Doge.Torso:MoveTo(part) --Fixed MoveTo() on lines 6, 8, and 10. (Don't forget to use torso, not humanoid!)
    wait(15)
    game.Workspace.Doge.Torso:MoveTo(part2)
    wait(15)
    game.Workspace.Doge.Torso:MoveTo(part3)
    wait(15) --Don't forget to always end a while true do loop with a wait.
end
0
Lol, Thanks i dent know i spelled humanoid worng Armoredtj 25 — 10y
0
Yes, Humanoid DOES have a :MoveTo() method. It just makes the character WALK to the position instead of teleporting. Also, Parts do NOT have a :MoveTo() method. Only models and humanoids. Tkdriverx 514 — 10y

Answer this question