How do I force to Pathfind in a specific Path

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    What I’m asking may seem easy but I want to force humanoids to walk in a path, I want Path Finding service to generate on these paths

    I know I could just create 1x1x1 parts and use a for i loop for path finding but i’d have to make a ton of those because of the countless combinations. For example;
    image
    For this part, how will I detect each path part if i choose to move to the right part, like what if I want to go back to the middle part from the right path will I have to create a separate part from moving from the right part to the middle path? do i have to overlap the paths with each other?
    image

It’s incredibly hard to explain but it’s the best I can explain

  1. What is the issue? Include screenshots / videos if possible!
    as i said
  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I haven’t tried anything since i don’t have any idea how to do the moving part or the detecting part, I do know how i’ll do the other concepts of the game
    ( the detecting part is essentially checking if the part in the middle can move units to the left and right parts )

I plan to make a similar game to this:

1 Like

I don’t have much experience with pathfinding but there is a library for it on github and I think it has a function which will suit your needs heres the link

https://github.com/Minhseu123/Roblox/blob/main/MinhXDPathfinder.lua

Thank you but is there a tutorial for this?

No I don’t think so sorry, hope you’ve found out how to use it

1 Like

the PathfindingService allows you to have PathfindingModifier

if we look at PathfindingService:CreatePath() we can see

that we can provide a table for costs

you can read more about modifiers here: Character Pathfinding | Roblox Creator Documentation

you can use -math.huge as the cost so the PathfindingService will always go over the parts you want


like this but instead of math.huge use -math.huge

I see Thank You! I’ll test it out later

Do I just parent the Pathfinding Modifier in Each path ?

Yes put the pathfinding modifier in every part and give them all the same label

Then in the costs table set the same label to -math.huge

Alright I see, Thank you! I haven’t started coding, but I have been building up to concept though, I just wanted to make sure that this was possible, thanks again!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.