you COULD use pathfinding modifers. BUT they’re in beta. So they only work in studio, not in-game. Soo yeah. I’d suggest for you to wait for pathfinding modifers to be out of beta so they work outside of studio.
If you don’t want to wait for pathfinding modifers to be out of beta. Then make a custom path. Heres an example file that you can use in your game: Custom path test.rbxl (64.9 KB)
Its actually pretty easy.(I assume you already know how to pathfind
Simply colour in the terrain you want the NPC to work on e.g. Concrete or Mud.
Then create a table of all the costs of the materials.
Then when creating the path simply add the table.
local PathfindingService = game:GetService("PathfindingService")
local path = PathfindingService:CreatePath({
Costs = {
Water = 20,
Mud = 5,
Neon = math.huge
}
})
Th higher the cost the less likely it will walk over it.
Compute the path then move the NPC alng the path. The article goes into it. I suggest looking carefully bat the code and understanding wha each line does.
You could make a part cost system but usually its a lot harder to setupimo
they DON’T work in game. They’re in Beta so they work in studio ONLY! Theres no point of using them in your game because they dont work outside of studio. Just wait for it to be out of beta.