local module = {}
-- //Services
local PathfindingService = game:GetService("PathfindingService")
-- //Folders
local NPCs = workspace:WaitForChild("NPCs")
local PathfindingFolder = workspace:WaitForChild("Pathfinding")
local StationFolder = PathfindingFolder:FindFirstChild("Stations")
local WaypointFolder = PathfindingFolder:FindFirstChild("Waypoints")
local BlockedParts = PathfindingFolder:FindFirstChild("BlockedParts")
local Values = script.Parent:FindFirstChild("Values")
-- //Variables
local ComputeAsync
-- //PathfindingService
local Path = PathfindingService:CreatePath({
AgentRadius = 4,
AgentHeight = 5,
AgentCanJump = true,
AgentCanClimb = true,
WaypointsSpacing = 5,
Costs = {
Block = math.huge,
}
})
-- //Tables
local WaypointIndex = {}
-- //StringValues
local Ticket = Values:FindFirstChild("Ticket")
local Station = Values:FindFirstChild("Station")
local Train = Values:FindFirstChild("Train")
function module:Pathfinding(player, character, Rig)
-- //Humanoid
local RigHumanoid = Rig:FindFirstChild("Humanoid")
-- //for loop WaypointFolder
for _, Part in ipairs(WaypointFolder:GetChildren()) do
local GetWaypoint = Path:GetWaypoints(Part)
WaypointIndex[Part.Name] = Part.Position
print(WaypointIndex)
local success, errorMessage = pcall(function(...)
ComputeAsync = Path:ComputeAsync(Rig.PrimaryPart.Position, WaypointIndex[Part.Name])
end)
-- //check
if success and Path.Status == Enum.PathStatus.Success then
--RigHumanoid:MoveTo()
else
warn("No Path found for:", Rig.Name)
end
-- //
RigHumanoid.MoveToFinished:Connect(function(latestPos)
end)
end
end
return module
I get no errors, issue is the rig doesnt walk around the part It just walks into it? ive just taught myself about pathfinding 2 days ago and this is the most i know.
That blue part, the rig walking to has a PathModifier - Label: Block [this is in my costs table for the PathfindingService:CreatePath()]. Just doesnt seem to work, am i missing something?
EDIT: changed some stuff. still no solution.