title says it, i cancel a bunch of collected tasks, then clear the table they were stored it, yet still they run after a few seconds…
code:
if collectedTasks[id] then
local collected = 0
for i,v in pairs(collectedTasks[id]) do
task.cancel(collectedTasks[id][i])
task.cancel(v)
v = nil
collectedTasks[id][v] = nil
collected += 1
end
local plr = game.Players:GetPlayerByUserId(id)
if plr then
clientFX:FireClient(plr,"Print","CLEANED "..collected.." COLLECTED TASKS" )
else
if game["Run Service"]:IsStudio() then
print("Print","CLEANED "..collected.." COLLECTED TASKS [NPC SURGE]")
end
end
end
print 1 means 4 tasks were cancelled, and the errors after about 3 seconds run an if statement inside of them regardless of being cancelled, i do not have callbacks or such in the task being cancelled… whats causing this problem
for reference this is the task being cancelled:
BurnThreads[id][b.Name] = task.delay(b.Dura,function()
if collectionService:HasTag(char,b.Name.."Burn") then
collectionService:RemoveTag(char,b.Name.."Burn")
if addedBurns[id][b.Name] then
addedBurns[id][b.Name] = nil
end
end
end)
