EZ Pathfinding V2

Recently I have been working a lot with the Pathfinding service and noticed it took quite a bit of time and about 50 lines of code. Today I decided to make a custom pathfinding API from scratch. It uses the normal roblox pathfinding, but only requires about 2 lines of code. It is very simple to use, especially if you are a beginner and saves you a lot of time.

If you would like to set it up you can require it.

Here is an example of how to use it:

local pathfinding = require(5575093153)

pathfinding:SetParams(2, 5, true) -- AgentRadius, AgentHeight, AgentCanJump

pathfinding:Move(script.Parent, game.Workspace.Destination) -- npc, destination

pathfinding:WalkSpeed(script.Parent, 25) -- npc, WalkSpeed number

pathfinding:JumpPower(script.Parent, 70) -- npc, JumpPower number

pathfinding:Jump(script.Parent) -- npc

You can get the module here:

If you have feedback, suggestion or questions, you can reply to this thread or message me.

I will update this every week and keep an update log for all of you to see.

Update Log:
8-17-20 - Part Movement : Example

local parts = {
	[1] = -- part 1
    [2] = -- part 2
}
pathfinding:PartMovement(script.Parent, parts) -- npc, part table

8-16-20 - Stopping the Current Path : Example

pathfinding:StopPath(script.Parent)

8-17-20 - Pausing between part movement : Example

pathfinding:PartMovementWait(wait time) -- change wait time to how long before moving on to the next part

8-18-20 - Part Tweening With Pathfinding : Example

pathfinding:PartTween(script.Parent, game.Workspace.Destination) -- part that's being tweened, destination

script.Parent.Touched:Connect(function(hit)
if hit.name == game.Workspace.Destination.Name then
pathfinding:DestroyAllWaypoints() -- suggested to be used as not using it can get a little messy
end
end)

8-19-20 - Customizing Tween Info : Example

pathfinding:SetTweenInfo(5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0)

This works, however for some reason it prints an error. If you can, ignore that error if you are using this.
8-22-20 - Fixed part tweening. It had to do with the coroutine I added in the last update.
/
Updating the npc’s current path : Example

pathfinding:UpdatePath(npc, end part) -- describes the info of the path you want to be updated.

8-25-20 - Pausing and resuming part tweening : Example

pathfinding:PausePartPath()

pathfinding:ResumePartPath()

/
Updating the part’s path : Example

pathfinding:UpdatePartPath(start part, end part)

8-26-20 - Stopping a part’s tweening : Example

pathfinding:StopPartTweening()

Stops the current part’s tweening.

9-9-20 - Made npc part movement much more efficient and time consuming. (Read the updated version in the update log section explaining it.)

9-11-20 - Destination Reached : Example

pathfinding.DestinationReached = function()
--code
end
  • I love this module! No feedback.
  • I like it but I have feedback (EXPLAIN).
  • I have a lot of feedback (EXPLAIN).

0 voters

Only vote if you have tried the plugin!

Video on how to use:

Notes:

  • EZ Pathfinding currently cannot move two rigs from one script.
35 Likes

Please can you provide a gif / video of this in action

4 Likes

That makes life so much easier🤯
However, i would suggest you also provide basic functions that would handle
Path has obstacle
Path update/refresh (new pos or nil to recalculate path)
and maybe Path stop (stop moving along path)

Then tbe module will definetaly have a great use!
Path

4 Likes

I just added a pause a resume function. I will try making a stop function to stop the path entirely. Your suggestions should come out within the next few days! Thanks for the feedback! :grinning:

My recording software isn’t compatible with the dev forum. I might try Gyazo.

Okay, I just released the stop function. You can now stop the current path and create a new one! There is also already a line of code that handles obstacles. Your other suggestions may come later today or sometime in the next week.

1 Like

I might try making a refresh/update path function later on today. I just created a youtube tutorial on how to use this module if you want to look at it to get a better understanding of the module.

You have forgotten to implement the video link to thw tutorial

2 Likes

Ah sorry, it is being uploaded right now. When it is finished, I will link it.

1 Like

If you have any questions or suggestions regarding the module, please make sure to tell me. Your stop function came out very useful and I think it helps the community more.

1 Like

Here is the youtube video link:

3 Likes

Pausing between part movement added! You can now set the wait time that the npc has to wait before moving onto the next part. (Can only be used for part movement.)

New Update! You can now tween parts using pathfinding. The part will tween towards its destination while avoiding obstacles. More settings for this to come soon! Enjoy this new update!

1 Like

Woo hoo! Another update has come to EZ Pathfinding V2! Now you can change the tween info with one line of code. (So far tweening only works with singular parts.) Enjoy messing around with different easingstyles and directions, time, reverses and so much more! :grinning:

1 Like

Cool module! I might use it when I need to use pathfinding, but currently I don’t.

Maybe this could be used for a parkour type game to make a ghost run the course to show you how its done (maybe for a tutorial…?)

3 Likes

I also suggest you learn OOP basics and convert this wonderful module into one
So then this would work

local PathfindingModule = require(5575093153)
PathfindingModule:SetParams(2, 5)
local newPath = PathfindingModule.new(NPC or PART)
newPath:MoveTo(target location)
newPath.AutoUpdatePathOnObstacle = true
newPath.DestinationReached:Connect(function()
   newPath:Stop()
   newPath:Remove()
end)
etc....
3 Likes

I was actually already planning to make a DestinationReached function. The RefreshPath function should come soon.

1 Like

DestinationReached function ? How is that going to work lol?

2 Likes

Whenever say the npc reaches a point, you can call that using that function. Then put your lines of code under it. This time each time it reaches a point, it can do something. It times it out much better than using the wait function.

1 Like

Also by the way, you don’t need to use the SetParams function if you are going to leave them as they are by default. If you do use that function make sure to add the agentcanjump part as that can cause jumping to not work. Example: pathfindingModule:SetParams(2, 5, true) Instead of: