Attempt to index nil with nil tells me that tonumber(goal)
returns nil
as goal
is not a number in string form. Double-check that. Also, using UpdateAsync
might be easier here.
local success, result = pcall(WDS.UpdateAsync, WDS, key, function(oldDD)
if oldDD and oldDD[number] then
oldDD[number] = nil
end
return oldDD
end)