SimplePath - Pathfinding Module

nice job. how can i make it loop waypoints but move to the next waypoint only when it reached the previous waypoint ?

I also had this stuttering effect happen on my rigs when I used SimplePath as well, And I managed to solve it using a simple formula.

path:Run(PlayerRootPart.Position * (PlayerRootPart.AssemblyLinearVelocity/3))
1 Like

Hello,

Sorry if I sound like a noob, but
In the module how exactly would I use this function?


When I mean how to use the function I mean how to get the character variable and make the NPC run to it.

this thing keep causing my pc to crash due to it erroring thousands of time a second making my cpu die and my memory skyrocket out of the roof like 5 seconds after i run it :skull:

Maybe you should learn to code better, it’s not the module.

1 Like

connecting to error just makes it send like a million call per second, i assume that’s due to me re running the path on the error but all i did was just following the example to see how it worked.
is it my fault? idk

Show the code you’re using for this, and the path it’s erroring.

it happened only when it couldn’t reach the target, saying “5 seconds” after i run the code was a little missleading, since it only occured when the path where the character was meant to go was obstructed by another object, but i already fixed it so

If the path is destroyed while its computing this module errors.

1 Like

would a pcall help? if that is an option for the code where it bombs out

I made a little module to set this up with a few useful pathfinding modes for anyone who wants it even simpler:

SimplerPathDemo.rbxl (93.9 KB)

2 Likes

Hi, I checked yours out.

  1. is it random what the npc does each time you Play? Like one time he goes to the white flashes , then another time he followed me.

  2. What are the red an green dots for?

  3. Why when the NPC is not moving does he jiggle a bit? (Do you have animation on them that we do not ?)

  4. One time he seemed to move and then seemed to get stuck, he also got stuck under the stairs one time…

Thanks for sharing I will check it out more!

Can you explain how you fixed the crashing? I just put in the code with the blocked then waypoint reached then error and when i get to the npc the game just crashes. So maybe what you did could help me too. Would really appreciate the help.

Hello everyone. So my game crashes when i approach the npc. The code is

local ServerStorage = game:GetService(“ServerStorage”)
local SimplePath = require(ServerStorage.SimplePath)

local Path2 = SimplePath.new(bot)

function attackPath(target, targetLocation)
local Goal = target.HumanoidRootPart.Position

Path2.Blocked:Connect(function()
	Path2:Run(Goal)
end)

Path2.WaypointReached:Connect(function()
	Path2:Run(Goal)
end)

Path2.Error:Connect(function()
	Path2:Run(Goal)
end)

Path2.Reached:Connect(function()
	Path2:Run(Goal)
end)

Path2:Run(Goal)

end

When i use the code with only the WaypointReached line of code and Path2Run line of code the game works. but when i try to put in the blocked and error together it crashes my game. Thanks for the help!

edit: Looks like its when the error code runs the game crashes. i have all parts of code together except the error code and the code works game is fine. But when i add the error code in the game crashes. When i added a wait in the error code to see what would happen the npc when close to player runs back and forth and jumps repeatedly.

If you know what is wrong let me know!
Thanks for the help again.

I didn’t really actually fix those i just removed some error handlers stuff from the example which stopped my memory leak causing crashes (like my pc was actually crashing).

(basically in the example it said to re run the path when it errored, but it just caused memory leaks)

And i was just testing that thing briefly so i didn’t actually spend time to fix this

robloxapp-20240403-2342218.wmv (5.2 MB)
Why is it acting like that making weird decisions and unnessecary things

bro what the hell is that theme :sob:

was messing around in settings and felt lazy to change it back

as for the code i ended up making a separate function

not working for me:/
Can someone assist me?

Works well with humanoids, but I’ve been having problems with non-humanoid parts. It seems to form what looks like a correct path but it repeatedly moves the part upwards and vaguely in the right direction instead. Using a humanoid is not really an option considering the limits on high-speed humanoids with pathfinding.