how do i pick up objects

I cant pick up some objects in my scene. I need help quick. Thanks

Make a script and when a key pressed it will pick up some objects.
public GameObject objectThatYouWant;
public GameObject playerWhoWillPickUpTheObject;

public void Update () {
    if(Input.GetKeyDown("space")) {
          objectThatYouWant.transform.parent = 
          transform.playerWhoWillPickUpTheObject;
    }
}