object do not responding on collision

Hy everyone, I just started recently with unity. I am developing a game in which I want to move an object along x axis. when user will click anywhere on screen(each time), the object will fall down and a new object will start moving at the same position of previous object. Till now I coded as follows but object is not moving after colliding with “Left Collider”.

using UnityEngine;
using System.Collections;

public class move : MonoBehaviour {

int temp = 0;
public GameObject box;
bool moveDirection;        
bool ifClicked = false;
	
void Start () {
    moveDirection = true;       // direction = true will allow the object to move along -x, or to x otherwise
    moveObj(box);
}	

void Update()
{        
    if (Input.GetButtonDown("Fire1"))
    {
        ifClicked = true;
        box.GetComponent<Rigidbody2D>().velocity = new Vector3(0,-10,0);            
    }

    else
    {
        moveObj(box);
        print(temp++);
    }
}                

GameObject moveObj(GameObject o)
{
    if (!moveDirection)
    {
        o.GetComponent<Rigidbody2D>().velocity = new Vector3(10, 0, 0);            
        return o;
    }
    else
    {
        o.GetComponent<Rigidbody2D>().velocity = new Vector3(-10, 0, 0);           
        return o;
    }       
}

void OnCollisionEnter2D(Collision2D coll)
{       
    if (coll.gameObject.name == "LeftCollider")    // also tried using coll.gameObject.tag  
        moveDirection = true;                    
   
    else if (coll.gameObject.name == "RightCollider")        
        moveDirection = false;                    
}   

}

Thanks in advace

You collide with LeftCollider, moveDirection becomes true and suddenly your moveObj code only lets you move left. You are flush up against an object already…of course you cant go left.