the whole time you have been autobuying improperly (near upgrade npc = attempt to purchase items). the issue was for i,v in next, (buyfunctions) do v(inv, currentupgrades, npctype and 'upgrade' or 'item') end
I replaced it with
for i,v in next, (buyfunctions) do v(inv, currentupgrades, npctype and 'item' or 'upgrade') end
the whole time you have been autobuying improperly (near upgrade npc = attempt to purchase items). the issue was for i,v in next, (buyfunctions) do v(inv, currentupgrades, npctype and 'upgrade' or 'item') end
I replaced it with for i,v in next, (buyfunctions) do v(inv, currentupgrades, npctype and 'item' or 'upgrade') end