NPC not jumping down platform

My NPC that I created isn’t jumping down platforms despite having the path computed fine, no clue why it’s doing this but I suspect that it has something to do with the if waypoints[nextWaypointIndex].Action == ... parts but to be completely honest I have no idea.

Video -

Script -

if script.Parent.HumanoidRootPart:CanSetNetworkOwnership() then
	script.Parent.HumanoidRootPart:SetNetworkOwner(nil)
end
--//--//--//--//--//--//--//-/-/-/--/-//---
local npc = script.Parent
local players = game:GetService("Players")



local pfs = game:GetService("PathfindingService")
local rs = game:GetService("RunService")

local path = pfs:CreatePath({
	AgentHeight = 7,
	AgentRadius = 4,
	AgentCanJump = true,
	
	Costs = {
		Water = 100;
		DangerZone = math.huge
	}
})
local hum = npc.Humanoid

--/-/-/-//-//-/-/-/-/----/-//-/-///-/-/-//--/-/-/-/-/-

local attackAnim = Instance.new('Animation')

attackAnim.AnimationId = "rbxassetid://11949372195"

local attackTrack = script.Parent:WaitForChild("Humanoid"):LoadAnimation(attackAnim)

attackTrack.Looped = false
---/-/-/-/-/-//-/-/-///-/-//-/-///--//-/-//-/-//---/-/
local waypoints
local nextWaypointIndex
local reachedConnection
local blockedConnection

local function findTarget()
	local maxDistance = 300
	local nearestTarget
	
	
	for index, player in pairs(players:GetPlayers()) do
		if player.Character then
			local target = player.Character
			local distance = (npc.HumanoidRootPart.Position - target.HumanoidRootPart.Position).Magnitude
			
			local qdb = false
			
			if distance <maxDistance then
				nearestTarget = target
				maxDistance = distance
			end
			
			--When Getting <5 to the player, the player takes damage
			
			if distance <5 and not qdb then
				nearestTarget.Humanoid:TakeDamage(0)
				attackTrack:Play()
				qdb = true
				wait(.5)
				qdb = false
			end
		end
	end
	
	return nearestTarget
end

local function followPath(destination)
	local success, errorMessage = pcall(function()
		path:ComputeAsync(npc.PrimaryPart.Position, destination)
	end)
	
	if success and path.Status == Enum.PathStatus.Success then
		waypoints = path:GetWaypoints()
		
		
		blockedConnection = path.Blocked:Connect(function(blockedWaypointIndex)
			if blockedWaypointIndex >= nextWaypointIndex then
				blockedConnection:Disconnect()
				followPath(destination)
			end
		end)
		
		if not reachedConnection then
			reachedConnection = hum.MoveToFinished:Connect(function(reached)
				if reached and nextWaypointIndex < #waypoints then
					nextWaypointIndex += 1
					hum:MoveTo(waypoints[nextWaypointIndex].Position)
					
					if waypoints[nextWaypointIndex].Action == Enum.PathWaypointAction.Jump then
						hum.Jump = true
					end
					
				else
					reachedConnection:Disconnect()
					blockedConnection:Disconnect()
				end
			end)
		end
		
		
		nextWaypointIndex = 2 --og 2
		hum:MoveTo(waypoints[nextWaypointIndex].Position)
		
		if waypoints[nextWaypointIndex].Action == Enum.PathWaypointAction.Jump then
			hum.Jump = true
		end
	else
		warn("path not computed", errorMessage)
	end
end

while wait() do
	local target = findTarget()
	if target then
		--print(target.Name)
		followPath(target.HumanoidRootPart.Position)
	end

end

Try add this

if waypoints[nextWaypointIndex].Action == Enum.PathWaypointAction.Jump then
    humanoid:Jump()
end

To replace the original? Also, I don’t think that this will work because :Jump() isn’t a function

I mean,

if waypoints[nextWaypointIndex].Action == Enum.PathWaypointAction.Jump then
    humanoid.Jump = true
end

Is this to replace the original in the script already? If so, I already have this, it jumps properly but doesn’t want to get off of the platform.

If it doesn’t want to get off of the platform i don’t know then never had or seen this problem.

I put a video demonstrating the issue, did you see it in my original post? Here is it again if you didn’t see it before.

yeah i know but don’t have any idea to fix this issue

Why are you setting it to 2? Try removing this line, and add;

nextWaypointIndex = 1

underneath

if success and path.Status == Enum.PathStatus.Success then

I did this and now it is shaking back and fourth, not moving anywhere.

Edit: I reverted the changes and put back in the original script and it’s still doing that… this wasn’t an issue before I have no idea what caused this.
Edit 2: I reloaded studio and got the backup of this game and the issue is fixed. I don’t know why.