Accessing A Variable From Another Script

OK. DONT DELETE THIS MODS. I HAVE SPENT HOURS TRYING TO UNDERSTAND THIS AND I NEED HELP.
Original Script:

private var UsernameField;
private var PasswordField;
public var PlayerUsername = "username";
public var PlayerPassword = "password";

function Start () {
	UsernameField = GameObject.Find("USERNAMETEXT").GetComponent("infoScript");
	PasswordField = GameObject.Find("PASSWORDTEXT").GetComponent("infoScript");
}

function Update () {
	PlayerUsername = UsernameField.info;
	PlayerPassword = PasswordField.info;
}

ok and the script its accessing on gameobjects called “USERNAMETEXT” and “PASSWORDTEXT” is called “infoScript”. The variable its trying to get the info from is “info”.

#pragma strict

public var info;
var TextboxContents : UI.Text;
 
function Update () {
	info = TextboxContents.text;
}

This pulls the text input from the UI.Text.text, however i get BCE0019: info is not a member of object. Please tell me how to fix this and WHY this doesn’t work before I lose my mind. Other things I’ve seen on the forums either don’t awnser my question or I can’t understand it.

You simply have to give your variables a type. You should always type your variables:

 private var UsernameField : infoScript;
 private var PasswordField : infoScript;
 public var PlayerUsername = "username";
 public var PlayerPassword = "password";
 
 function Start () {
     UsernameField = GameObject.Find("USERNAMETEXT").GetComponent(infoScript);
     PasswordField = GameObject.Find("PASSWORDTEXT").GetComponent(infoScript);
 }
 
 function Update () {
     PlayerUsername = UsernameField.info;
     PlayerPassword = PasswordField.info;
 }
 
 //infoScript.js
 #pragma strict
 
 public var info : String;
 var TextboxContents : UI.Text;
  
 function Update () {
     info = TextboxContents.text;
 }

When you say it pulls out the text it means it works? You can see the text input in one script in the other with a debug?

Other thing… where is text defined in TextboxContents = I understand Textbox is UI.Text but .text?