how to destroy an object on collision with c++

hello everyone,
i’m new to unreal engine , but i know c++.
i need to know how to add code to a object.
For example i have created a project with the fps template(in c++).
i want to destroy the cubes whe the projectile hit their.
I have configured destructible mesh, but there is a problem, when the player hit the cubes, them destroy.
i need to destroy the object before the change of mesh to the destructible, but the player cannot destroy it with a collision, only with the bullet(projectile).
(sorry for my english)