I want my npc to go around a part using path finding modifiers, but it isn’t working. Can someone please help thanks
local Modifer = Instance.new("PathfindingModifier", workspace.BlockPart)
Modifer.ModifierId = "KillPart"
local Costs= {
AgentRadius = 2,
AgentCanJump = false,
KillPart = math.huge
}
local NPC = script.Parent
NPC.PrimaryPart:SetNetworkOwner(nil)
local human = NPC.Humanoid
local path = pathfindingservice:CreatePath(Costs)
path:ComputeAsync(NPC.HumanoidRootPart.Position, game.Workspace.EndPart.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
if v.Action == Enum.PathWaypointAction.Jump then
human.Jump = true
end
human:MoveTo(v.Position)
human.MoveToFinished:Wait()
end
end