why is this not working?

I am getting pretty far with my inventory. hoqwever ir an into something that is bewildering me.

I am able to get my inventory to show a “stack count”

However when I pickup an item, it doesnt stack.

I am getting to the end of the function for stacking but it doesnt update the inventory count.

Can someone help me find the flaw in the logic/scripting?

The inventory array variable is a copy of the player inventory. Not a reference.

oh I have it as a reference?