Troubles with setting array elem for inventory

Is that not what I’m doing currently?