How to set scoring system with item over lapping box collision?

I’m trying to make a game where the player has to collect toys and put them in a toy box to increase their score. While the pick up object and scoring system work as needed, if the player continues to hold onto the item that triggers the score to increase and moves it over the box collision it continuously increases the player score. How do I make it so it only increases the score by one per item?

Count everything what is in the box instead of simply increasing?!
Decrease when the player takes something out?!

It does count everything inside the box while increasing. It does not decrease when something is removed.

So simply set the value to the amount of entries in the box

It’s set to pick up and drop with “E”. If the player doesn’t drop the item and continues to move it about the box collision, it continues to increase the score. If I set the amount of entries in the box, will that fix this problem? Thank you for your replies.

Make an array of toys that are placed into the box.
Use AddUnique() to add a new toy to the box. This way each toy will be added to the array only once.
Get the array length to know the number of toys in the box.


Thank you so much for the reply! Do you think you could walk me through it a little bit more? I’m still very new to working with Unreal and haven’t done much work with Array’s yet. I have a blueprint for the toy box and one for the toys. Would this array go into the box’s blueprint?

Depending on where you keep track of the toys, but yes, probably the box.
Just an array of type %YourToyClass%
[AddUnique] node will check if a toy has already been added to the array, and if not, add it.
[Length] node will show you how many toys are added.