Picking Up Items With a Line Trace

Make a master class for all items you will need to pick up. Then make each individual item a child of that master class. For your text, you could just say on hit, cast the hit actor to the master item class. If that works, then show the message, if not, dont show the message. The pickup itself could just simply be adding the item to an array, and hiding it in the world.

There are tutorials out there, and if you have the time I would suggest watching them. They helped me a lot.