A problem getting a specific player from an NPC pathfinding script

  1. What do you want to achieve? Keep it simple and clear!
  • So my Idea was to create a quest where you talk with a certain NPC and another one playing the role of a kidnapper starts running by using pathfinding. When the NPC arrives at the specific point it should cancel a quest.
  1. What is the issue? Include screenshots / videos if possible!
    However I can’t seem to get the specific player doing the quest to get his quest cancelled and instead the game cancels everybody’s quest. No matter the quest type or name.

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I looked for solutions all over the DevHub, all possible dev forums, etc. and tried all solutions I could get my hands at but nothing seemed to work.

I can provide you with the pathfinding script of the kidnap NPC which is where the game detects when he arrives at the specific location. For further information about the quest module I use I will provide.
Here is the Pathfinding script:

local PathfindingService = game:GetService("PathfindingService")
local RunService = game:GetService("RunService")
local Players = game.Players:GetPlayers()

local path = PathfindingService:CreatePath()

local npc = script.Parent
local humanoid = npc:WaitForChild("Humanoid")

local TEST_DESTINATION = game.Workspace.DEST.Position

local waypoints
local nextWaypointIndex
local reachedConnection
local blockedConnection

local questmodule = require(game.ServerScriptService.Quests.Kidnapper)


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()
		npc.PrimaryPart:SetNetworkOwner(nil)

		blockedConnection = path.Blocked:Connect(function(blockedWaypointIndex)
			if blockedWaypointIndex >= nextWaypointIndex then
				blockedConnection:Disconnect()
				followPath(destination)
			end
		end)

		if not reachedConnection then
			reachedConnection = humanoid.MoveToFinished:Connect(function(reached)
				if reached and nextWaypointIndex < #waypoints then
					nextWaypointIndex += 1
					humanoid:MoveTo(waypoints[nextWaypointIndex].Position)
				else
					for i, v in pairs(game.Players:GetPlayers()) do
						questmodule.Cancel(v)
					end
					npc:Destroy()
					reachedConnection:Disconnect()
					blockedConnection:Disconnect()
				end
			end)
		end

		nextWaypointIndex = 2
		humanoid:MoveTo(waypoints[nextWaypointIndex].Position)
	else
		warn("Path not computed!", errorMessage)
	end
end

followPath(TEST_DESTINATION)

This line causes the issue.
In order to even get the player in the first place, I assume you will be starting this quest with the given player. Pass the player given on to this script, and then pass it in questmodule.Cancel()