Help making a pathfinding NPC

I want to make an NPC follow a player, while at the same time not going into walls, about like the bots in piggy, but I am new at scripting adn I don’t know how to make something like this, can anyone sugest me any Link to a page, YouTube video, or a script that could help me?

I suggest that you take a look at my pathfinding module. You can easily pathfind NPCs using just a few lines. I made the module for beginner scripters like yourself.

3 Likes

I really think that page will help me, thanks for that! :grinning:

I still don’t know how to use it.

1 Like

Take a look at the example script:

local Rig = workspace:WaitForChild("Dummy") --Get rig
local SimplePath = require(6336743234) --Get module
local Part = workspace:WaitForChild("Part") --Define goal part

local Path = SimplePath.new(Rig) --Create new Path
Path:Run(Part.Position) --Start moving the Rig

Path.Completed:Wait() --Wait until Rig reaches the final position
Part.BrickColor = BrickColor.new("Bright green") --Change part color

Path:Destroy() --Destroy Path object after use

I also made an example place that uses the above script, you can find the file on the SimplePath devforum page.

1 Like

Aha ok, thanks, but what if I want it to target the player, do I put the goal part the Torso?

Yep, that’s bascially what you do. Just get the position of the HumanoidRootPart and do Run(pos).

Im sorry if im annoying but I don’t really know what to put in the box for: WaitForChild(“–here–”)

You can probably use this tut for this as well however V3NOM_Z is the right modules are very useful too!

1 Like

there is a youtuber called GnomeCode, and he has made tutorials on this! He will explain it carefully, so I suggest watching him!

Also, the DevKing is good for this too.
Maybe AlvinBlox.
Idk man, idk.