Hello, I’m currently working on an horror game I made a while ago, but I gave up because of some errors.
Just for fun, i’m trying to see if I can fix the errors. Right now I have a function which moves the character to different locations when idling. These locations are passed as a parameter “location” but for some reason it spams “Enum.PathStatus.NoPath”
function moveMonster(location)
local path = PathfindingService:CreatePath({
AgentRadius = 2, -- Adjust based on the monster's size
AgentHeight = 5, -- Adjust based on the monster's size
AgentCanJump = true, -- Change if the monster cannot jump
AgentJumpHeight = 7, -- Adjust based on monster's jump capabilities
AgentMaxSlope = 45 -- Adjust based on terrain
})
path:ComputeAsync(monsterRoot.Position, location)
if path.Status == Enum.PathStatus.Success then
local waypoints = path:GetWaypoints()
if #waypoints > 0 then
local firstWaypoint = waypoints[1]
-- Move to the first waypoint
monsterHumanoid:MoveTo(firstWaypoint.Position)
monsterHumanoid.MoveToFinished:Wait()
end
else
warn("pathfinding couldnt complete.") -- always prints this
print(tostring(location) .. " wasnt computable with " .. tostring( monsterRoot.Position))
return nil
end
end
My output looks like this:
pathfinding couldnt complete.
-147.2730712890625, 4.983977317810059, 163.16082763671875 wasnt computable with -120.101806640625, 3, 128.22506713867188
pathfinding couldnt complete.
-147.2730712890625, 4.983977317810059, 163.16082763671875 wasnt computable with -120.101806640625, 3, 128.22506713867188
as mentioned I’m not sure why it keeps saying “No Path” because those locations seem achievable. Also my character seems to be able to walk normally as seen in my chase script: