This script worked fine before 3.0 . And i know you changed the Self.ItemCount but i just cant wrap my head around what's wrong.

PHP Code:
-------------------------------------------------------
 ------------
Avani's special variables looter----------
-------------------------------------------------------

DestBP = "Jewelled Backpack" -- BP by name
MaxAmount = 4 -- Amount of items you want to loot max.
monstersToLoot = {"Dead Nightmare Scion","Dead Tiger","Dead Nightmare"} -- Monster you want to loot
itemsToLoot = {3577, 3582} -- Items you want to loot

---------------------------------------------------------
---------------------------------------------------------

local counter = 0
while (true) do
    for i=0,# monstersToLoot do
        local MainBp = Container.GetByName(monstersToLoot[i])
        local DestinationBp = Container.GetByName(DestBP)
        for spot = 0, MainBp:ItemCount() do
            local item = MainBp:GetItemData(spot)
            for x=0,# itemsToLoot do
                if (item.id == itemsToLoot[x]) then
            counter = 0
            for y=0,# itemsToLoot do
            counter = counter + Self.ItemCount(itemsToLoot[y])
            end
            if counter < MaxAmount then
                MainBp:MoveItemToContainer(spot, DestinationBp:Index(), 0)
                end 
                    wait(500)
                end
            end
            end
        end
        
    wait(200)
end