How to destroy multiple of the same actor

So I’m working on a project for school, and part of it is to have a player collect 5 keys. I wanted to go above what I assume is the standard for the class, and make the game as well designed as possible. One of the ideas I had to do that included the idea that, once a key is obtained, all copies of that same key would be destroyed. The idea here was that, if this were a live game, a player can’t find some way to clone the same key 5 times to get all 5 keys required, as getting one of those 5 would destroy the other 4. Here’s the code I had, but unfortunately it only destroys the key the player collided with.

Note I’m sure this looks entirely newbish, like I said I’m in school and this is for a class, I’m very new at this.

Maybe when you collect the key. Get All Actors Of Class > foreachloop > from the array element > =equal object to the key that you picked up is true > do nothing ; if it was not true > destroy actor.

This checks all key actors and if it finds your current key in that array of actors then do nothing. But if it was not your key, destroy it.

Hello,
What Muntrax said is the best way to do if you need to get all your actors once or twice or not have a lot of them in your level. If you need more, you can set an array of all your keys on begin play or when they are spawned then use this array to destroy other items.