SimplePath - Pathfinding Module

I don’t know how this module does it, but it was an absolute lifesaver with being able to cancel previous paths

i love you glorious grayzcale :star_struck:

does simplepath have a timeout when getting stuck?

Why does my client side code does not work? Its in starterplayerscripts, it should work

local SimplePath = require(game.ReplicatedStorage:WaitForChild("SimplePath"))

local events = {
    Create = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("CreatePath");
    Start = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("StartPath");
    Stop = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("StopPath");
    Destroy = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("DestroyPath");
}
local paths = {}

local function Create(Agent)
    if Agent:IsA("Model") and Agent:FindFirstChild("Humanoid") and Agent:FindFirstChild("HumanoidRootPart") and not paths[Agent] then
        paths[Agent] = SimplePath.new(Agent)
    end
    return paths[Agent] --can be ignored for sure
end
local function Start(Agent, Destination) --specific agent to pathfind
    local path = paths[Agent]
    if path then
        print("RUNNING") --it prints but agent doesnt pathfinds?
        path:Run(Agent.HumanoidRootPart.Position + Vector3.new(math.random(15, 20), 0, math.random(15, 20)))
    end
end
local function Stop(Agent) --specific agent to stop
    print("stop called")
    if paths[Agent] then
        if not SimplePath.StatusType.Idle then
            paths[Agent]:Stop()
        end
    end
end
local function Destroy(Agent) --destroy Path (used when agent is dead) 
    print("destroy called")
    paths[Agent]:Destroy()
    paths[Agent] = nil
end

events.Create.OnClientEvent:Connect(Create)
events.Start.OnClientEvent:Connect(Start)
events.Stop.OnClientEvent:Connect(Stop)
events.Destroy.OnClientEvent:Connect(Destroy)

I wonder what makes simple path switching from pathfinding routes so quickly without much delay

I believe it does, but take quite a while

1 Like

Currently having a issue with the script, not sure if this script still is being supported but I have my Path:Run(Goal) in a while true do statement, its going to its first location but when I change the goal it doesn’t go to the other goal or even visualize it. Can anyone help?

The bool side of the system is working as when the goal is changed, the old goal’s bool is changed to false and the new one is changed to true so I know its receiving the new goal, plus I am printing the new goal which is working correctly so that side of the system is working, idk what the issue could be.

In other words, the script is supposed to run as:
When the goal’s name is 1 then don’t run the while statement anymore, if its not 1 then keep changing the goal to a number down until it is and then move to the new goal location.

Currently it works as:
When the goal’s name is 1 then don’t run the while statement anymore, if its not 1 then keep changing the goal to a number down until it is and then stay at the old goal location.

while Goal == nil or tonumber(Goal.Name) ~= 1 do -- As long as the name of Goal isnt 1 and Goal is nil then
		task.wait()
		for i, v in pairs(game.Workspace.LoadingLine:GetChildren()) do -- Folder with all the goals
			if v.Taken.Value == false then -- If the bool value in the goal is not faluse then
				if Goal == nil then -- if the goal is nil then
					Goal = v -- set the goal to v
					v.Taken.Value = true -- set the taken bool value to true
				else -- if we have a previous goal then
					if tonumber(Goal.Name) - 1 == tonumber(v.Name) then -- if v is one number smaller then our current goal then
						print(Goal, v) -- for debugging which is working correctly
						Goal.Taken.Value = false -- change the old goal Taken bool back to false
						Goal = v -- set our new goal
						v.Taken.Value = true -- set the Taken bool value to true
						print("New goal") -- also for debugging
					end
				end
			end
		end
		Path:Run(Goal) -- run the goal no matter what because a goal will always be present
	end

does simpath work with PathfindingModifier? like pathway volume or materials.

Hello just askin, but anyway this uses Params on the pathfinding? and is there anyway we can customize it? I have a custom AI and I would like to customize it since it has a humanoid, but sometimes it would just jump or move right above the walls, it also just try’s to push itself through a wall and it get’s stuck, so i was just wondering if it does have params, how do we like add our own to it?

Contributors: I’m sharing my experiences contributing to an open source path finding module called SimplePath. It makes walking easier, and not just for humanoids, with a simple solution that accurately recalculates routes on the fly when they’re obstructed. This ensures consistent navigation, thus an ideal solution for Roblox developers.

1 Like

Yes it does, just make sure to properly name the tags.

Hi, umm, is there a link to what you are open sourcing?

Thanks

Hey @GrayzcaIe, i’m having some problems with a script using your module, and someone suggested it could be the module itself. Could you check out my topic?

How would you add/enable truss climbing for simple path?

Put {AgentCanClimb = true} in AgentParams