Help with Pathfinding AI

I’m currently updateting the old AI for my game and i have a problem with the Pathfinding.
This was the old AI:


The new AI:

But now u can easly escape the AI:


The moving code:

local Waypoints = path:GetWaypoints()
				
for i,Waypoint in ipairs(Waypoints) do
	EnemyHumanoid:MoveTo(Waypoint.Position)
					
	if Waypoint.Action == Enum.PathWaypointAction.Jump then
		EnemyHumanoid:ChangeState(Enum.HumanoidStateType.Jumping)
	end
					
	EnemyHumanoid.MoveToFinished:Wait(1)
	--Debug			
	local b = Instance.new("Part")
	b.Size = Vector3.new(1,1,1)
	b.Shape = "Ball"
	b.Anchored = true
	b.Material = Enum.Material.Neon
        b.Parent = workspace
	b.Position = Waypoint.Position
	b.CanCollide = false
	b.BrickColor = rColor
end

maybe this tutorial could help you, This still works for me

1 Like