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. 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. 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)

1 comment
We need to see the Cancel Function of the Quest Module. Your error is probably in there.