I was testing different path for him to follow, like paths with jumping so I could make sure he’d work in different scenarios. He knows he should take the truss but he just… doesn’t. The problem is that the movetofinished() never fires, and idk why? why wont he walk into it and climb it?
Video of the problem:
These are the two revelant functions in a module script:
(YES, canclimb is set to true)
function Pathfinding.GetPath(Name, Goal, Start)
if not Start then
Start = Agents[Name].HRP.Position
end
local Waypoints
local Path = PathfindingService:CreatePath({
AgentRadius = 1,
AgentHeight = 2.5,
AgentCanJump = Agents[Name].CanJump,
AgentCanClimb = Agents[Name].CanClimb
})
local Success, ErrorMsg = pcall(function()
Path:ComputeAsync(Start, Goal)
end)
if Success then
print(Success)
return Path
else
warn("Pathfinding Failed: "..ErrorMsg)
end
end
function Pathfinding.FollowPath(Name, Path:Path)
local Humanoid:Humanoid = Agents[Name].Humanoid
print(Path:GetWaypoints())
for _, waypoint:PathWaypoint in pairs(Path:GetWaypoints()) do
print(_)
if waypoint.Action == Enum.PathWaypointAction.Jump then
while Humanoid:GetState() == Enum.HumanoidStateType.Jumping or Humanoid:GetState() == Enum.HumanoidStateType.Freefall or Humanoid:GetState() == Enum.HumanoidStateType.Landed do
task.wait()
end
print(Humanoid:GetState())
Humanoid.Jump = true
end
Humanoid:MoveTo(waypoint.Position)
print(waypoint.Position)
print("now we wait...")
Humanoid.MoveToFinished:Wait()
end
end
The server script:
local CollectionService = game:GetService("CollectionService")
local Pathfinding = require(script.Parent.Pathfinding)
workspace:WaitForChild("Goal")
for _, enemy in pairs(CollectionService:GetTagged("Enemy")) do
Pathfinding.SetUpAgent("Test", enemy, true, true, 90, 100, 20)
local Path = Pathfinding.GetPath("Test", workspace.Goal.Position)
print(Path)
Pathfinding.FollowPath("Test", Path)
end