load level if you have enough money

hi so i have a decision level where you need to pick between 2 doors, the door costs 320$, i can’t seem to figure out how to write the script i did write this but something about the int is wrong any help would be appreciated

using UnityEngine;
using System.Collections;

public class Door1 : MonoBehaviour {

public GUI amount;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void OnTriggerStay (Collider Door) {
if(Input.GetKeyDown("b") && amount>319){
	Application.LoadLevel("test");
}

}
}

I’m guessing the amount is stored in a player class.

If there is only one player you could make the amount static:

public static int amount;

In your trigger function:

void OnTriggerStay (Collider Door) {
if(Input.GetKeyDown("b") && Player.amount>319){
    Application.LoadLevel("test");
}