Why won't PathFinding work on my custom Humanoid?

Screenshot 2024-12-12 103218

I tried implementing this on a default dummy, and it seems to work, until I tried it on a deer model. It prints out “Failed to create path to Plectocron!” from my server script. Here’s the server script:

local RunService = game:GetService(“RunService”)

– Require the Pathfinding module
local PathfindingService = game:GetService(“PathfindingService”)
local Path = require(game.Workspace.SimplePath) – Assuming your pathfinding script is named “Pathfinding”

– Get references to Dummy and Plectocron
local dummy = script.Parent
local plectocron = workspace:WaitForChild(“Plectocron”) – Replace with actual path to Plectocron
local agent = {
AgentRadius = 5, – Set the agent radius
AgentHeight = 5, – Set the agent height
AgentCanJump = true, – Set whether the agent can jump
– Add any other relevant parameters here
}

– Function to update the target and start chasing
local function chasePlectocron()
local targetPosition = plectocron.PrimaryPart.Position
local path = Path.new(dummy, agent)
local success = path:Run(targetPosition)
if not success then
print(“Failed to create path to Plectocron!”)
end
end

– Call chasePlectocron initially and repeatedly
chasePlectocron()

RunService.Heartbeat:Connect(function()
chasePlectocron()
end)

2 Likes

This is using a pathfinding module, so we dont know whats going on in that module that could be the problem.

2 Likes

I think it is how you are computing your path:

local success = path:Run(targetPosition) -- << NOT THIS
local success, errorMessage = pcall(function()
	Path:ComputeAsync(character.PrimaryPart.Position, destination)
end)

Have a look at the Creator doc as it will help you:

2 Likes