Why is it saying "unknown identifier 'PR'"? help!

So I ran into an issue while scripting, the way I did the variable i’ve used the same exact way. So why is unity telling me it dosn’t recognize it? (line 7 for the variable and 24 for the error)

#pragma strict
private var fall : boolean;
var Player : GameObject;
var spawnPoint : Transform;
var stomp : boolean;
function Update () {
	var PR = gameObject.GetComponent(playerRespawn);
	if(stomp){
		transform.position.z = 4;
		transform.localScale.y /= 2;
		fall = true;
		gameObject.GetComponent(EnemyMove2).step = 0.0;
		stomp = false;
	}
	if(fall){
		transform.position.y -= 0.05;
	}
	if(transform.position.y < -25){
		Destroy(gameObject);
	}
}
function OnTriggerEnter (other : Collider){
	if(other.tag === "Player"){
		PR.Dead = true;
	}
}

PR is defined only in the Update function. If you wish to use it in other functions, put var PR outside of the functions, with the rest of your variable declaration.

This is an issue of variable scope. Variables live and die within the set of curly braces they are declared in. You defined PR inside of Update() so once Update() is finished, that variable disappears.

The variable ‘Player’ is defined inside this class so it will exist for all functions inside this class. Other classes can access it as well if it is public or, better yet, they can also access private variables through accessor functions designed to expose certain properties of a class to other classes. Accessor functions are better because they give a class more control over how your variables are being altered than simply making the variable itself public.

Yeah, but it seems like anywhere inside the OnTriggerEnter function it will give me an error “You are not allowed to call this function when declaring a variable. Move it to the line after without a variable declaration.” or the original problem.
Here is the script im referencing:

var X = 0;
var Y = 0;
var Z = 2;
var DeathZoneY= -5;
var Dead : boolean = false;
function Update () {
	if(Dead){
		transform.position.x = X;
		transform.position.y = Y;
		transform.position.z = Z;
		Dead = false;
	}

	if(transform.position.y <= DeathZoneY){

		transform.position.x = X;
		transform.position.y = Y;
		transform.position.z = Z;
	}
	if(transform.position.x <= 86) {
	Z = 2;
	Y = 3;
	X = 86;
	}
	
};

I don’t think that you can or need to declare that Dead is a boolean and initialize its value. Try: var Dead = false;

OMG! i’m stupid. Never needed any of this to begin with Q_Q I looked closely why my OnTriggerEnter wasnt working…
it was an OnCollisionStay >.> I’m stupid but thanks for the knowledge for the future!