How can i make a text pop up when one player approaches another?

I am very new to this, pardon me if my question is too simplistic.

I am creating a game where when one player approaches another a dialogue box should pop up; This is my script for player one walking towards player 2, when player one is close to player two i want a dialogue box to pop up with the words “dont come near me”

using UnityEngine;
using System.Collections;

public class groundmove : MonoBehaviour {
void Start () {

	transform.position = new Vector3 (-4, 0.6f, 0);

}

void Update () {
	transform.Translate(Vector3.right * Input.GetAxis("Horizontal"));

}

}

Add this code to your script:

private bool displayText = false;

void OnTriggerEnter() {
     displayText = true;
}

void OnTriggerExit() {
     displayText = false;
}

void OnGUI {
     if(displayText == true) {
          GUI.Label(new Rect(100, 100, 200, 50), "don't come near me");

     }
}

Also, at least one player object needs a rigidbody + collider and the other one needs a collider set to “IsTrigger = true”.