I am making a zombie pathfinding system but the zombie acts like in the video above and also does not climb trusses despite having the params set to be able to climb the truss.
local Zombie = script.Parent
local Humanoid = Zombie.Humanoid
local HRP = Zombie.HumanoidRootPart
local PS = game:GetService("PathfindingService")
local function FindClosestPlayer()
local dist,player = math.huge,nil
for i,v in pairs(game.Players:GetPlayers()) do
local plrdist = v:DistanceFromCharacter(HRP.Position)
if plrdist <= dist then
player = v
dist = plrdist
end
end
return player
end
local function Walk()
local Player = FindClosestPlayer()
if not Player then return end
coroutine.resume(coroutine.create(function()
local Character = Player.Character
local PlayerHRP = Character.HumanoidRootPart
local Path:Path = PS:CreatePath({AgentCanClimb = true,AgentRadius = 4,WaypointSpacing = 2,
Costs = {
Props = math.huge
}})
local S,R = pcall(function()
Path:ComputeAsync(HRP.Position,PlayerHRP.Position)
end)
if S then
local waypoints = Path:GetWaypoints()
for i,v:PathWaypoint in pairs(waypoints) do
Humanoid:MoveTo(v.Position)
if v.Action == Enum.PathWaypointAction.Jump then
Humanoid.Jump = true
end
Humanoid.MoveToFinished:Wait()
end
else
print(R)
end
end))
end
while Humanoid.Health > 0 do
Walk()
wait()
end