Unsticking game objects

I have used

void OnCollisionEnter(Collision collision) {     collision.gameObject.transform.parent = gameObject.transform; } 

To stick two players together when they connect, how do i make the game object not stuck when they come apart ?