Detect for click on multiple objects and duplicate the one that was clicked

I have searched the armory forums and have found good solutions for detecting mouse clicks, but I am making a game where you would click on an object to buy it, like a turret in a tower defense game (example btd6). I would like to find a way to duplicate any object that was clicked (not any object, but a list of them). My current code is here (ignore where I left out the transform, it doesn’t matter where the object is spawned because in the game, you will be able to move it):
image
Edit: The Object: Cube node is what should be replaced with something that can either switch through values or check for all values. I could just duplicate all this code, but that doesn’t seem like a good idea.

What if try using ‘Collections’ and Raycast Closest Object, attaching the script to ‘Scene Properties > Armory Scene Traits’?! And already from this, somehow dance.

Thx! I’m new to armory so I don’t know all the blocks. I managed to shorten it to just this:
image