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

Why does MoveTo teleport the NPC instead of making them walk?

Asked by
Prioxis 673 Moderation Voter
9 years ago

I'm making a randomly walking person that walks between a set of nodes I made but for some reason he just teleports to each node??

Heres my script :

while wait() do
    local points = game.Workspace.Nodes:GetChildren()
    local randomPoint = points[math.random(1,#points)]
    local Minion = game.Workspace.NPC
    local Table = {}

    Minion:MoveTo(randomPoint)
    repeat wait() until (Minion.Torso.Position - randomPoint.Position).magnitude <= 2 
end

1 answer

Log in to vote
2
Answered by
Ryzox 220 Moderation Voter
9 years ago
while wait() do
    local points = game.Workspace.Nodes:GetChildren()
    local randomPoint = points[math.random(1,#points)]
    local Minion = game.Workspace.NPC
    local Table = {}

    Minion.Humanoid:MoveTo(randomPoint) -- Use it on Humanoid (if it has humanoid)
    repeat wait() until (Minion.Torso.Position - randomPoint.Position).magnitude <= 2 
end


MoveTo() used on a model will make the model teleport to that position, but using MoveTo() on a Humanoid will make it walk.

Ad

Answer this question