So I made an attempt to make a pathfinding Ai but, it will not jump. can someone help?
local humanoidrootpart = script.Parent:FindFirstChild("HumanoidRootPart") local human = script.Parent:FindFirstChild("Humanoid") function findTarget() local distant = 200 local target = nil for i,v in pairs(workspace:GetChildren()) do local humanoid = v:FindFirstChild("Humanoid") local head = v:FindFirstChild("Head") if humanoid and head and v.Name ~= "wacky monster" then if (head.Position - humanoidrootpart.Position).magnitude < distant and humanoid.Health > 0 then distant = (head.Position - humanoidrootpart.Position).magnitude target = head end end end return target end while wait(0) do local head = findTarget() if head then local ray = Ray.new(humanoidrootpart.Position, (head.Position - humanoidrootpart.Position).Unit * 200) local hit,position = workspace:FindPartOnRayWithIgnoreList(ray,{script.Parent}) if hit then hit:IsDescendantOf(head.Parent) human:MoveTo(head.Position) else human:MoveTo(head.Position) wait(.4) local path = game:GetService("PathfindingService"):FindPathAsync(humanoidrootpart.Position,head.Position) local points = path:GetWayPoints() if path.Status == Enum.PathStatus.Success then for i,v in pairs(points) do human:MoveTo(v.Position) human:MoveToFinished() wait(2) if v.Action == Enum.PathWaypointAction.Jump then human.Jump = true end if (points[#points].Position - head.Position).magnitude > 15 then break end end else human:MoveTo(head.Position) end end end end