easy! Make a trigger around the object, and attach a script to it that uses OnGUI and OnTriggerStay and Exit. In the ontrigger part, have it check to see if the player is in the trigger, and if the e key has been pressed. if so, then set a variable to true, that would cause a message in OnGUI to actvate.
this code will show the message when you’re in trigger and press e, and the message will leave after you leave the trigger.
var showMessage = false;
var player : GameObject;
function OnTriggerStay (collider : Collider) {
if (collider.gameObject == player Input.GetKeyDown("e")) {showMessage = true;}
}
function OnTriggerExit (collider : Collider) {
if (collider.gameObject == player) {showMessage = false;}
}
function OnGUI () {
if (showMessage) {
//this is where you put the message box.
}
}
I haven’t tested it, so there could be a typo or something i’ve overlooked, but it should work.