How do I condense my code for my triggers?

Hi Everyone, I’m here again :slight_smile:

I have a trigger outside each door so when I collide with it it shows the room number and says press C to open the only problem is I have a different script for each door so it shows I different room number.

My code is below, I just what to know how I would compress it down to a single script if possible.

var displayMessage = false;
var font : Font;
var fontSize : int = 20;

function OnTriggerEnter (other : Collider) {
	displayMessage = true;

function OnGUI () {
if (displayMessage){
	GUI.Label (Rect (10, 10, 200, 60), "Room 2

Press C To Open"); = = = font; = = = fontSize;

function OnTriggerExit (other : Collider) {
	displayMessage = false;

Use a variable that stores the room number, and set that from the inspector.