# Inventory Duplicate bug

**URL:** <https://forums.unrealengine.com/t/inventory-duplicate-bug/2270752>\
**Category:** Blueprint\
**Tags:** unreal-engine, question, Blueprint\
**Created:** [January 11, 2025, 5:16am UTC](https://forums.unrealengine.com/t/inventory-duplicate-bug/2270752 "2025-01-11T05:16:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Omni\_Fluxx](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/omni_fluxx/32/888564_2.png) [@Omni\_Fluxx](https://forums.unrealengine.com/u/Omni_Fluxx)\
**Post date:** [January 11, 2025, 5:16am UTC](https://forums.unrealengine.com/t/inventory-duplicate-bug/2270752/1 "2025-01-11T05:16:23Z")

</div>

Okay i have this weird bug in which the items at first glance work as intended. my items list as training sword x3 properly, but that’s if i collect three IN A ROW.

 ![Screenshot 2025-01-11 000727](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/2/9/5298c0bf38b447d1c8625359a8b574a84c57ab78.png)  
But here’s what happens when I collect two different items then collect two more of the first item collected.  
 ![Screenshot 2025-01-11 000800](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/6/3/16397d91190c4ca391683eea5f1af333d899013c.png)

each item is now listed separately as opposed to increasing the quantity. Arrays are still weird to me so if someone can help out i appreciate it!

here’s my logic for adding items into the inventory:

 ![Screenshot 2025-01-11 000835](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/c/e5c625a125188245e8d8edd837806fc0cdb3c034.png)  
 ![Screenshot 2025-01-11 000850](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/c/5/8c5ce0c3f33ecec09704f88113632b31df95c2a6.png)  
 ![Screenshot 2025-01-11 000903](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/8/a/68a5f5278da6769821cad7130b0d8f6057a907c5.png)  
 ![Screenshot 2025-01-11 000910](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/0/e/a0e5eba043799e2f14aef6e34b66e0f2c0d966ae.png)

Sorry for the lengthy question.

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [January 11, 2025, 5:33am UTC](https://forums.unrealengine.com/t/inventory-duplicate-bug/2270752/2 "2025-01-11T05:33:17Z")

</div>

Your ItemAlreadyInInventory is failing.

the return node breaks the loop so its only checking the first value, put a branch before it and only return if true.

a few other efficiencies you can do

1. Use SetMembersInStruct rather than copying all the values
2. you can get the StructRef and not even have to SetArrayElement

---

<div class="post-metadata">

**Author:** ![Omni\_Fluxx](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/omni_fluxx/32/888564_2.png) [@Omni\_Fluxx](https://forums.unrealengine.com/u/Omni_Fluxx)\
**Post date:** [January 11, 2025, 6:29pm UTC](https://forums.unrealengine.com/t/inventory-duplicate-bug/2270752/3 "2025-01-11T18:29:47Z")

</div>

Thanks! I’m dumbfounded that one simple branch node impacts that code, I also appreciate you explaining what’s happening! I’m still learning!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [February 10, 2025, 6:30pm UTC](https://forums.unrealengine.com/t/inventory-duplicate-bug/2270752/4 "2025-02-10T18:30:12Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
