I am trying to make a pathfinding zombie, but it doesn't handle jumps very well. The new FindPathAsync I know for sure can do jumps, but I can't figure out how to use it, so I'm using getRawPathASync.
Heres a link to a photo: https://totallypalehideout.tumblr.com/image/174606148248
And heres my code:
wait(3)
local pathfindService = game:GetService("PathfindingService")
local PlayerService = game:GetService("Players")
local localCharacter = script.Parent
local start = localCharacter.Torso
local PointModel = Instance.new("Model")
PointModel.Parent = game.Workspace
PointModel.Name = "Points"
pointModel = game.Workspace.Points
local function FindClosestPlayer(inRange)
local playerDistance, closestPlayer = inRange
for _, player in pairs(PlayerService:GetPlayers()) do
local character = player.Character
local blip = character:FindFirstChild("HumanoidRootPart")
if blip and character.Parent and character ~= localCharacter then
local blipDist = (start.Position - blip.Position).Magnitude
if blipDist <= inRange and blipDist < playerDistance then
playerDistance, closestPlayer = blipDist, player
end
end
end
return closestPlayer, playerDistance
end
while true do
chosenPlayer = FindClosestPlayer(10000)
if chosenPlayer then
if chosenPlayer.Character.Humanoid.Health ~= 0 then
local path = pathfindService:ComputeRawPathAsync(start.Position, chosenPlayer.Character.LowerTorso.Position, 10000)
local points = path:GetPointCoordinates()
if points[6] then
part = Instance.new("Part")
part.FormFactor = Enum.FormFactor.Custom
part.Size = Vector3.new(1, 1, 1)
part.Transparency = 1
part.Position = points[6]
part.Anchored = true
part.CanCollide = false
part.Parent = pointModel
elseif points[5] then
part = Instance.new("Part")
part.FormFactor = Enum.FormFactor.Custom
part.Size = Vector3.new(1, 1, 1)
part.Transparency = 1
part.Position = points[5]
part.Anchored = true
part.CanCollide = false
part.Parent = pointModel
elseif points[4] then
part = Instance.new("Part")
part.FormFactor = Enum.FormFactor.Custom
part.Size = Vector3.new(1, 1, 1)
part.Transparency = 1
part.Position = points[4]
part.Anchored = true
part.CanCollide = false
part.Parent = pointModel
elseif points[3] then
part = Instance.new("Part")
part.FormFactor = Enum.FormFactor.Custom
part.Size = Vector3.new(1, 1, 1)
part.Transparency = 1
part.Position = points[3]
part.Anchored = true
part.CanCollide = false
part.Parent = pointModel
elseif points[2] then
part = Instance.new("Part")
part.FormFactor = Enum.FormFactor.Custom
part.Size = Vector3.new(1, 1, 1)
part.Transparency = 1
part.Position = points[2]
part.Anchored = true
part.CanCollide = false
part.Parent = pointModel
elseif points[1] then
part = Instance.new("Part")
part.FormFactor = Enum.FormFactor.Custom
part.Size = Vector3.new(1, 1, 1)
part.Transparency = 1
part.Position = points[1]
part.Anchored = true
part.CanCollide = false
part.Parent = pointModel
end
if part then
script.Parent.Humanoid:MoveTo(part.Position)
script.Parent.Humanoid.MoveToFinished:Wait()
end
pointModel:ClearAllChildren()
end
end
end

5 comments
Well, I already knew it was deprecated, but I wanted to use it since the wiki made it a lot more confusing than it needed to be. I'll try this out.
It worked, thanks!
Actually, it doesn't work totally as expected. It still won't jump from block to block
You can try to figure it out from there.
I was thinking now is if one of the points is below the zombie position it will jump.you can check the each position with points variable it stores all the points.