Third person Picking an object

Hi, i need to create a Function in MaingameMode that will simulate a picking object. for Example, i have ball that spawn in my scene and I want that my character when i’m near a ball it will follow him while pressing F. For now, i created and event graph that call a function with F pressed. But i have no idea how to do that function. Thanks and Its a third person game! i’m new to UE4.

Note : an animation will come later that will do a real pick up, but its not my task and will come very later