adding a script to the gameObject global scope

Is this the correct way to make a script public for other scripts to access?

Script name = PlayerHealth.js

public var PlayerHealthInstance : PlayerHealth;

function Start () { 
	gameObject.AddComponent ("PlayerHealthInstance");
}

This seems correct, but it’s not in the global scope, I’m getting this error when trying to access it from another script:

Unknown identifier: ‘PlayerHealthInstance’

You are mixing things here so it is hard to advise. If you just want a “global” variable you have to add the keyword “static.” So say I had a “Foo” script that was attached to one or more objects. I could do something like:

public static var iVal : int = 21;

This would create a single iVal even if there are multiple game objects with the “Foo” script attached. Other scripts can access this variable like:

iLocal = Foo.iVal;

Now in your case, you it appears that you are adding a component, but here…

public var PlayerHealthInstance : PlayerHealth;

You are using the component name as a variable of type “PlayerHealth” which you don’t define, so I’m not sure what you are doing.