destroy actor when that actor is being clicked

hello im new to unreal engine and the past couple days i have been messing arround with the engine and c++. i managed to make a first person camera. now i want that when i click an actor(lets say this actor is just a cube) that it destroys himself. i want to do this so i can learn to make buttons in my game. so i started searching on the internet how i can register or an actor is being clicked. i found nothing, the only thing what i think i could use is an onclicked function but i did not find any documentation of how to use it. so is there someone who knows a documentation for this or knows how to do this and can explain it to me please ?

Hi Dolfijn. Here is a resource that you should find useful:

http://students.ceid.upatras.gr/~vpapadatos/UE4cpp_6_MouseSelection.html

Just to note: If you are referring to menu buttons you will want to be using a widget, which will be done differently.