1st post - GUIText score updating from coin pickup, but not from door question

Hi all, this is my 1st post. I have been on this for about 2 weeks as I get time to mess with this. I have parts of the scoring working, (pick up a coin and the GUI text add it up.) Now I am stuck on having the GUI text update each time a question is answered (by pressing a key on the keyboard for the right answer). Player walks up to a door - a question is presented to him, they answer correctly by pressing the right key, an animation lifts up the door and (the part I am stuck at) they are awarded a certain number of points, and if incorrect, - a certain number of points.

I have a script attached to my player watching for coins. COIN SCRIPT

// JavaScript
static var coinValue : int = 5;
var speed = 5;
function Update()
{
transform.Rotate(Vector3.right * speed);
}

PLAYER SCRIPT

var guiScore : GUIText;
static var counter : int =0;
function Start()
{
guiScore.text = “Score: 0” ;
}

function OnTriggerEnter(other : Collider )
{
Debug.Log(“OnTriggerEnter() was called”);
if (other.tag == “coin”)
{
Debug.Log(“Other object is a coin”);
counter += coin.coinValue;
guiScore.text = "Score: " + counter;
Debug.Log(counter) ;
//Destroy(other.gameObject);
}
}

function update()
{
guiScore.text = "Score: " + counter;
}
DOOR SCRIPT

//javascript

static var doorValue : int = 20;
function OnTriggerEnter(Collider :Collider)// this tells the player which keys to press

{

if (Collider.tag == “Player”)

{
drawGUI = true;

}
}

function OnTriggerExit(Collider :Collider)
{

if (Collider.tag ==“Player”)
{

drawGUI = true;
}
}

function OnGUI () {

if (drawGUI == true)
{

GUI.Box(Rect(Screen.width*0.5-51, 200, 202, 22), “Press 1 or 2”);
if (Input.GetKeyUp(KeyCode.Keypad2))
{
drawGUI = false;
questionPanel.animation.CrossFade(“q8panela”);
roomDoor.animation.CrossFade(“q8panelb”);
roomDoor2.animation.CrossFade(“q8panelc”);
roomDoorMain.animation.CrossFade(“q8door”);
increase();

}

if (Input.GetKeyUp(KeyCode.Alpha2))
{
drawGUI = false;
questionPanel.animation.CrossFade(“q8panela”);
roomDoor.animation.CrossFade(“q8panelb”);
roomDoor2.animation.CrossFade(“q8panelc”);
roomDoorMain.animation.CrossFade(“q8door”);
}
}
}

function increase()
{
playerscore.counter += doorValue;

Debug.Log(playerscore.counter);
}

Sorry for the long post, and I formatted the code as best I can to post it here. This is a volunteer project and I am a truck driver by trade. I have started Unity as a hobby and am loving it.

Thanks

http://forum.unity3d.com/threads/143875-Using-code-tags-properly

–Eric

sorry, i’ll repost later…