Current Version: 0.23
Needed to make a pathfinding script but discovered how complicated it can be especially for beginner programmers. Several things need to be included in the script in order to create a decent pathfinding script.
The SimplePath module skips the hassle of scripting all the different parts to a pathfinding script and simplifies everything for you.
Get SimplePath
local SimplePath = require(6336743234)
API
Version History
Update 0.23:
- Fixed a bug involving NetworkOwnership.
Update 0.22:
-
SimplePath.new()
saves the Path object at default. This can now be disabled (see docs). Disabling this feature maximizes the performance but the Path object specific to the rig will not be retrievable (if the Path object was saved, it is automatically retrieved if you runPath.new()
on the same rig). - Implemented the custom wait module by @PysephDEV
- Minor bug fixes.
Update 0.21:
- Fixed a bug where the rig sometimes skipped waypoints if you use
:Run()
continuously. - Added a path visualize feature, use
Path:Run(FinalPosition, true)
to visualize the path.
Update 0.20:
- Added a new feature where if you create a new Path object, it will check if it’s already been created and returns a previously Path object called on that same rig. This will avoid creating multiple Path objects on the same rig and therefore prevent memory leaks. Requested by @MohhayScripts .
Source Code
Basic Example
SimplePath Example.rbxl (40.7 KB)
(This is just a minimal example of what you can do with this module)
local Rig = workspace:WaitForChild("Dummy") --Get rig
local SimplePath = require(6336743234) --Get module
local Part = workspace:WaitForChild("Part") --Define goal part
local Path = SimplePath.new(Rig) --Create new Path
Path:Run(Part.Position) --Start moving the Rig
Path.Completed:Wait() --Wait until Rig reaches the final position
Part.BrickColor = BrickColor.new("Bright green") --Change part color
Path:Destroy() --Destroy Path object after use
What you can make in just a few lines...
Compute a new path instantly as the final position changes
(Path:Run()
is spam proof)
local rig = workspace.Dummy
local SimplePath = require(6336743234)
local goal = workspace.Part
local Path = SimplePath.new(rig)
Path:Run(goal.Position)
goal:GetPropertyChangedSignal("Position"):Connect(function()
Path:Run(goal.Position)
end)
Keybind Horse (Pet System)
local Path = SimplePath.new(MountRig)
local Choices = {7, -7}
local FinalPosition = nil
while Path:Distance(HRP) > 8 do
FinalPosition = (HRP.CFrame * CFrame.new(Choices[math.random(1, #Choices)], 0, 0)).Position + HRP.Velocity
Path:Run(FinalPosition)
Path.Completed:Wait()
end
Path:Destroy()