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

Trying to script an enemy AI using AI Pathfinding?

Asked by 5 years ago

Hi, I'm a beginner scripter and I'm trying to figure out how to use the Pathfinding service. I've watch the Roblox tutorial and tried to get this working multiple times but have failed.

Here is my script,

path = game:GetService("PathfindingService"):ComputeRawPathAsync(workspace.Start.Position, workspace.Finish.Position, 200)

points = path:GetPointCoordinates()

for p = 1, #points do
    script.Parent:MoveTo(points)
end

Thanks

0
If you haven't read this, this is a really good guide imo https://www.robloxdev.com/articles/Making-a-Patrolling-NPC-in-Roblox Vulkarin 581 — 5y
0
Use local variables. Globales are bad practice. User#19524 175 — 5y
0
Thanks for the link to the article it's very helpful! SpacePuppyMan 31 — 5y
0
No problem Vulkarin 581 — 5y

Answer this question