Hi guys, so I've seen that "CheckOcclusionAsync" is able to re-visualize a set path, but it's an expensive operation so I want to try and avoid it. That being said, here's my failed code even though it seems to be the correct approach than my successful code (I did not add in the jump action in this failed code so, just ignore that for now as it's not important):

local MonsterCharacter = script.Parent
pfs = game:GetService("PathfindingService")
local MonsterHumanoid = MonsterCharacter.Slime
local Goal = workspace.GoalPart

while true do
	local CurrentLocation = MonsterCharacter.Torso.Position
	local path = pfs:FindPathAsync(CurrentLocation, Goal.Position)
	local waypoints = path:GetWaypoints() 

	for i, v in pairs(waypoints) do
		--The following are just for visualization of the path--
		local part = Instance.new("Part")
		part.Position = v.Position
		part.Color = Color3.new(50,50,0)
		part.Size = Vector3.new(1, 1, 1)
		part.Anchored = true
		part.Parent = game.Workspace
		part.CanCollide = false
		--End of visualization--
		MonsterHumanoid:MoveTo(v.Position)
		local reachedTarget = MonsterHumanoid.MoveToFinished:wait() --line22
	end
	wait(0.3)
end

The problem with this code is that using "MoveToFinished" is equivalent to making the ai finish walking towards the goal, hence if the goal moved, it will still continue walking towards it where it last was.

Another method is to remove line 22. Doing so immediately generate all the waypoints required to reach the goal. Problem with this is that the "MoveTo(V.Position)" causes the ai to move towards the final waypoint, and that's a problem due to the ai just trying to get to that point (Disregard walls and action required, hence it;s as good as just a MoveTo() without utilising the pathfinding service).

Here's my successful solution but it seems wrong:

local MonsterCharacter = script.Parent
pfs = game:GetService("PathfindingService")
local MonsterHumanoid = MonsterCharacter.Slime
local Goal = workspace.GoalPart

while true do
	local CurrentLocation = MonsterCharacter.Torso.Position
	local path = pfs:FindPathAsync(CurrentLocation, Goal.Position)
	local waypoints = path:GetWaypoints() 
	MonsterHumanoid:MoveTo(waypoints[3].Position) --Line 10
	if waypoints[3].Action == Enum.PathWaypointAction.Jump then --Line11
		MonsterHumanoid.Jump = true
	end		
	wait()
end

What I feel is wrong about the above code is that looking at line 10 and 11, I'm basically just reading ahead the position 3 elements ahead of what's perceived from the path finding service (Anything lower than 3 elements will cause the AI to jerk as the waypoints were not created in time). If there's any "more correct" method, can someone enlighten me with it? Thanks