I want to add 1 point to my other .js script but it doesn’t work.
Here’s my code. Gotoquiz1 is the name of my script a.
static var score : int = 0 ;
print("Score: "+ score);
gotoquiz1.score += 1;
You probably have to define the gotoquiz1 object as a script before it can associate the right property (score in your case) with it. Try adding this to script B and assigning script A to it in the inspector:
var gotoquiz1 : Script;
Make sure you have the other script available.
var gotoquiz1 : Gotoquiz1; // you said that’s your script, right? Gotoquiz1.js?
Now assign that with the Inspector by dragging the object containing Gotoquiz1.js onto that exposed variable.
gotoquiz1 = GetComponent.<Gotoquiz1>(); // if the script is on the same object
gotoquiz1 = GameObject.Find("otherobject").GetComponent.<Gotoquiz1>(); // if the script is on the 'other object'