Set a String Global variable value

Hi Everyone,

I was wondering if any one knew how to set a string global variable.
I have attempted this:

var myName : String;
function Update(){
if(whatever){
ScriptName.StringVariable = myName;
}

Thanks, I would appreciate the help and will give good ratings :smiley:

You could use a static variable. Iā€™m not sure of how it works exactly in javascript.

public Static string StringVariable;

function Update()
{
  if(whatever){
    ScriptName.StringVariable = myName;
  }
}

public static var playerName:String;

...
if (whatever)
{
  playerName = "the Name";
}