So yeah i was following path finding tutorials and messing around and well my npc decided to fly / triple jump did i write my code wrong or is it just roblox glitching / i placed walls wrong. GIF There are 2 invis walls on each side no others Code:

local PathfindingService = game:GetService("PathfindingService")

local plr = script.Parent
local humanoid = plr.Humanoid
local destination = game.Workspace.End
 
local path = PathfindingService:CreatePath()
 
local waypoints
local currentWaypointIndex = 0

local function showwaypoints()
	local max = #waypoints
	for i, v in ipairs(waypoints) do
		print(i)
		print(v)
		local part = Instance.new("Part")
		part.Shape = "Ball"
		part.Material = "Neon"
		part.Name = tostring(i)
		part.Size = Vector3.new(0.6, 0.6, 0.6)
		part.Parent = game.Workspace.WayPoints
		part.Position = v.Position + Vector3.new(0, 3.5, 0)
		part.Anchored = true
		part.CanCollide = false
		if i == 1 then
			part.BrickColor = BrickColor.new("Lime green")
		elseif i == max then
			part.BrickColor = BrickColor.new("Really red")
		end
	end
end
 
local function followPath(destinationObject)
	print("follow")
	path:ComputeAsync(plr.HumanoidRootPart.Position, destinationObject.Position)
	waypoints = {}
 
	if path.Status == Enum.PathStatus.Success then
		waypoints = path:GetWaypoints()
		showwaypoints()
		currentWaypointIndex = 1
		humanoid:MoveTo(waypoints[currentWaypointIndex].Position)
		
		if waypoints[currentWaypointIndex].Action == Enum.PathWaypointAction.Jump then
			humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
		end
	else
		humanoid:MoveTo(plr.HumanoidRootPart.Position)
	end
end
 
local function onWaypointReached(reached)
	print("reached")
	if reached and currentWaypointIndex < #waypoints then
		currentWaypointIndex = currentWaypointIndex + 1
		humanoid:MoveTo(waypoints[currentWaypointIndex].Position)
		if waypoints[currentWaypointIndex].Action == Enum.PathWaypointAction.Jump then
			humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
		end
	end
end
 
local function onPathBlocked(blockedWaypointIndex)
	if blockedWaypointIndex > currentWaypointIndex then

		print("blocked")
		followPath(destination)
		
	end
end


path.Blocked:Connect(onPathBlocked)
 
humanoid.MoveToFinished:Connect(onWaypointReached)
 
followPath(destination)

also if you've got any script improvements / anyways to fix it please comment / reply!