NoobPath | Easy Pathfinding

NoobPath is a Pathfinding module script with Auto Timeout, Non-humanoid support and Waypoint adjustments!

Get it here: NoobPath - Creator Store
Version 1.2

Inspired by SimplePath by Grayzcale :+1:
Most Signals/Methods Interchangeable With SimplePath :slight_smile:

I suggest checking out SimplePath first :heart:

GoodSignal by stravant is used in this module :star_struck:


All the example code assume you have a script inside a Humanoid Rig

local NoobPath = require(PathToNoobPath)

local Guy, JumpDetectConnection = NoobPath.Humanoid(script.Parent, {WaypointSpacing = 10})
-- Parameter 1 is a Character Model, Parameter 2 is AgentParams(Basically settings for pathfinding)

Check Here for Pathfinding basics


Signal Implementation & Partial Demonstration Example:

local NoobPath = require(PathToNoobPath)

local Guy, JumpDetectConnection = NoobPath.Humanoid(script.Parent, {WaypointSpacing = 10, PathSettings = {SupportPartialPath = true})

if Guy.Idle then -- Access Character state through .Idle
    print("Idle")
end

Guy.Reached:Connect(function(Waypoint, IsPartial)
	print("Reached: " .. tostring(Waypoint) .. " | Partial: " .. tostring(IsPartial))
	task.wait(0.1)
	Guy:Run()
end)

Guy.WaypointReached:Connect(function(Waypoint, NextWaypoint)
	print("WaypointReached: " .. tostring(Waypoint) .. " | NextWaypoint: " .. tostring(NextWaypoint))
	Guy:Run()
end)

Guy.Error:Connect(function(ErrorType : string)
	print("Error: ".. ErrorType)
	task.wait(0.1)
	Guy:Run()
end)

Guy.Trapped:Connect(function(TrapType : string)
	print("Trapped: ".. TrapType) 
	if script.Parent.Humanoid:GetState() ~= Enum.HumanoidStateType.Climbing then -- Climbing is slower than usual
		Guy.Jump() -- Jump to unstuck
	end
	
	Guy:Run()
end)

Guy.Timeout = true -- Off by default, it calculate time necessary to travel between Waypoints and Check if the Character arrived after that amount of time, Trapped will be fired if the Character didn't reach Waypoint in time
Guy.Speed = 16 -- 16 by default, used to allow Timeout calculate time necessary to travel between Waypoints
Guy.Visualize = true -- Off by default, basically generate visual spheres to represent Waypoints

Guy:Run(workspace.SpawnLocation) -- If a Location is given to :Run(), it will be stored and become the default Location to go if there's no argument given
-- Location : Vector3 | BasePart | Model

Loop Implementation Example:

local NoobPath = require(PathToNoobPath)
local Guy,JumpDetectConnection = NoobPath.Humanoid(script.Parent, {WaypointSpacing = 10})

Guy.Visualize = true

while true do
	task.wait()
	Guy:Run(workspace.SpawnLocation)
end

Non-humanoid Example:

local NoobPath = require(PathToNoobPath)

-- NoobPath.Humanoid() pass in those functions & signals with humanoid defaults
-- There's no JumpDetectConnection as you have to set things up manually
local Guy = NoobPath.new(
	script.Parent,
	{WaypointSpacing = 10},
	function(PositionToGo : Vector3)
		-- custom logic to move the Character to PositionToGo
	end,
	function()
		-- custom logic to make the Character Jump
	end,
	JumpFinishedSignal, -- place a signal here to indicate Finished Jumping, it can be Roblox Signal, BindableEvent.Event, or just use the GoodSignal inside the module
	MoveFinishedSignal -- place a signal here to indicate Finished Moving, it can be Roblox Signal, BindableEvent.Event, or just use the GoodSignal inside the module
)

-- Remember to Destroy when not using
local NoobPath = require(PathToNoobPath)
local Guy, JumpDetectConnection = NoobPath.Humanoid(script.Parent, {WaypointSpacing = 10})
-- Do Stuff
Guy:Stop()
-- Do Stuff
JumpDetectConnection:Disconnect()
Guy:Destroy()

Methods & Signals & Variables not demonstrated in the examples are Private

16 Likes

What differentiates this from for example SimplePath that you mentioned and other pathfinding systems?

maybe the first sentence :person_shrugging:
“NoobPath is a Pathfinding module script with Auto Timeout, Non-humanoid support and Waypoint adjustments!”

1 Like

:man_facepalming: I asked too quickly, thank you for the clarification

lets goo this module works better than simplepath!

Also, u made this post when i wanted to find a pathfinding module lol

1 Like

Does this work out of the box with the recent pathfinding update (e.g. partial paths)?

Yes, new pathfinding features works with the module. If a partial path got generated, it will be treated just like a regular path, I just updated the module to fire reached with an additional IsPartial boolean parameter. However, right now partial path is inconsistent, since pathfinding service sometimes return either partial path or no path under similar conditions, triggering and switching between error and reached signal. But enabling partial path does give you a higher chance to reach or at least get close to the destination if no path was found. Other new features works with the module.

1 Like