What is wrong or what is missing

i have an object who swing from left to right or right-left between (-0,3 and 0.3), and what i want to do is when i press any key “space” the object fall to the ground.

using UnityEngine;

using System.Collections;

public class DropBox: MonoBehaviour {

 void Update() {
     if (Input.GetKeyUp(KeyCode.Space))
         GetComponent<blocks>().enabled = true;

     if (Input.GetKeyUp(KeyCode.Space))
         GetComponent<blocks>().enabled = false;
 }

71214-dadas.jpg

71215-reeed.jpg

The block_0 is inside an empty object called (blocks). And the component block_0 is connected to the crane, and crane has a script who swing. The block_0 is a prefab.