My bot is jumping before reaching the waypoint where it was supposed to jump
function IA.persuitPlayer(plr, yieldable)
if plr:IsA("Player") then
if IA.checkPlayerDistance(plr) == true then
print("Can chase Player !")
chasing = true
local path = PathfindingService:CreatePath({["WaypointSpacing"] = 0.5})
while chasing == true and canChase == true do
task.wait()
path:ComputeAsync(humanoidRootPart.Position, plr.Character.HumanoidRootPart.Position)
for _, waypoint in pairs(path:GetWaypoints()) do
humanoid:MoveTo(waypoint.Position)
if (waypoint.Position.Y-model.LeftFoot.Position.Y) > 2.5 then
humanoid.Jump = true
end
end
end
else
warn("Player Is Too Far.")
end
end
end
Video: