Do not delete GUI after 2nd collision

I’ve found a script for activating GUI on collision (1).
Here’s the script :

using UnityEngine;
using System.Collections;

public class messagebox : MonoBehaviour {

 public Transform other;
   void OnGUI() {
        if (other) {
            float dist = Vector3.Distance(other.position, transform.position);
         if(dist < 10 ){GUI.Box (new Rect(0,0,100,100),"Well done!!");


         }

        }
  }
}

But after second collision (bouncing ball) the GUI disappears.
How I can make the GUI ‘lock’? I should use another type of GUI (I mean, not GUI.Box or something different)? I’m trying to change bits of the text, but nothing works.
Or maybe I should use GUI.Enabled?

You need to use a separate variable to keep track of the fact that you’ve turned on the box.

public class messagebox : MonoBehavior {
  bool displayBox;

  void Update()
  {
    // get the distance
    float d = Vector3.Distance(other.position, transform.position);

    // once the distance is below 10, turn on the box - it will stay on
    // until displayBox is set back to false
    if (d < 10)
      displayBox = true;

  }

  void OnGUI()
  {
     if (displayBox)
     {
       GUI.Box(new Rect(0, 0, 100, 100), "Well done!!");
     }
  }
}