Path finding AI

Do you want to just use this?
NoobPath

local NoobPath = require(PathToNoobPath)
local Path = NoobPath.Humanoid(human.Parent)
Path.Speed = normalWalkSpeed
Path.Timeout = true

local function FollowNearestPlayer()

    local nearestPlayer = getNearestPlayer()
	if nearestPlayer and nearestPlayer.Character and nearestPlayer.Character:FindFirstChild("HumanoidRootPart") then
		human.WalkSpeed = normalWalkSpeed
        local targetPosition = nearestPlayer.Character.HumanoidRootPart.Position
       
        Path.Trapped:Connect(function()
			print("sum is blocking its path")
		end)

        Path:Run(targetPosition)
    else
        human.WalkSpeed = 0
		if human.WalkSpeed > 0 then
			error("NPC didnt change speed")
		end
    end

end
1 Like