I have a problem using pathfind. I’ve never used it, I’m just learning about it.
When my character is above 2.5 studs, the bot stops chasing, but I just programmed it to only jump
function IA.persuitPlayer(plr, yieldable)
if plr:IsA("Player") then
if IA.checkPlayerDistance(plr) == true then
print("Can chase Player !")
chasing = true
while chasing == true and canChase == true do
task.wait(0.1)
local path = PathfindingService:CreatePath({["WaypointSpacing"] = 0.5})
path:ComputeAsync(humanoidRootPart.Position, plr.Character.HumanoidRootPart.Position)
for _, waypoint in pairs(path:GetWaypoints()) do
if math.abs(waypoint.Position.Y-model.LeftFoot.Position.Y) > 2.5 then
humanoid.Jump = true
end
humanoid:MoveTo(waypoint.Position)
end
end
else
warn("Player Is Too Far.")
end
end
end
In the documentation it says that the Default value is true, so I didn’t put it. but just in case I put it in now, and it didn’t work, it keeps stopping
function IA.persuitPlayer(plr, yieldable)
if plr:IsA("Player") then
if IA.checkPlayerDistance(plr) == true then
print("Can chase Player !")
chasing = true
while chasing == true and canChase == true do
task.wait(0.1)
local path = PathfindingService:CreatePath({["WaypointSpacing"] = 0.5})
path:ComputeAsync(humanoidRootPart.Position, plr.Character.HumanoidRootPart.Position)
for _, waypoint in pairs(path:GetWaypoints()) do
if waypoint.Action == Enum.PathWaypointAction.Jump then
humanoid.Jump = true
end
humanoid:MoveTo(waypoint.Position)
end
end
else
warn("Player Is Too Far.")
end
end
end
Hey dude, can you try this real quick? it’s worked for me, doesn’t matter the height
function IA.persuitPlayer(plr, yieldable)
if plr:IsA("Player") then
if IA.checkPlayerDistance(plr) == true then
print("Can chase Player !")
chasing = true
while chasing == true and canChase == true do
task.wait(0.1)
local path = PathfindingService:CreatePath({["WaypointSpacing"] = 0.5})
path:ComputeAsync(humanoidRootPart.Position, plr.Character.HumanoidRootPart.Position)
for _, waypoint in pairs(path:GetWaypoints()) do
humanoid:MoveTo(waypoint.Position)
if waypoint.Action == Enum.PathWaypointAction.Jump then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
print('jumping')
end
end
end
else
warn("Player Is Too Far.")
end
end
end
maybe not the smoothest - but a start. Setting jump to true in your first example only allows the humanoid to jump. You gotta changed the HumanoidStateType to make it jump manually
I’ll need to find a way to debounce it. So long as your jump height is 7.2, the first jump should be fine. But I know I need to debounce mine or it does go flying after the first jump lmao