How to set Textbox UI to Selected Object name?

I’ve lookd high and low for a good thread on this and I can’t find anything. Right now i have a script that shoots a ray when u left click and if it hits an object it returns hit info and, i think, the Objects name. Theres just one problem, it wont display it at all in my textbox which is attached to another script. What am I doing wrong?

This one is the text box script:
2636500--185453--Screen Shot 2016-05-15 at 7.41.11 PM.png

This is the Ray/selection script:

you’re using the same variable names in two completely separate scripts and thinking they’ll somehow interact… they don’t.

Script1.ObjectSelected and Script2.ObjectSelected are totally different variables.

You need to link the two scripts together with a reference (although you’d probably need to restructure the whole thing for that), or use event listeners to loosely link the two functions.