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

Help on targeting AI pathfinding?

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

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) "

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