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

Help on targeting AI pathfinding?

Asked by
Mystdar 352 Moderation Voter
10 years ago

I am trying to make a AI pathfinder got to different objects other than a Torso, I have tried different things, but they haven't worked, this is the Torso section:

while true do
        wait(math.random(1,5))
        local target = findNearestTorso(script.Parent.Torso.Position)
        if target ~= nil then
            script.Parent.Humanoid:MoveTo(target.Position, target)
        end
end

I have tried changing the findNearestTorso to different things but that hasn;t worked, I am trying to make it go a part in the workspace called GOAL. I have tried:

local target = game.Workspace.GOAL.Position

But that didn't work, either.

1 answer

Log in to vote
1
Answered by
3dsonicdx 163
10 years ago

The problem is 'findNearestTorso' is a function likely used from the follow script. Look back at the follow script(If you don't have it, grab it from a free model.), and grab the function for that.

Why not try "script.Parent.Humanoid:MoveTo(game.Workspace.Goal.Position) "

Ad

Answer this question