respawn menu wont work

ive tried to set up and respawn menu within my player damage script and i cannot see why it will not work

@scriptExecuteInEditMode()

varmaxHitPoints : int;
varhitPoints : int;
varpainSound : AudioClip;
vardie : AudioClip;
vardeadReplacement : Transform;
varmySkin : GUISkin;
varexplShake : GameObject;
privatevarradar : GameObject;
vardamageTexture : Texture;
privatevartime : float = 0.0;
privatevaralpha : float;
privatevarcallFunction : boolean = false;

staticvarPlayerIsDead = false;

functionStart(){
//hitPoints = maxHitPoints;
alpha = 0;
}

functionUpdate(){
if (time > 0){ 
time -= Time.deltaTime;
 }
alpha = time;
}

functionPlayerDamage (damage : int) {
if (hitPoints < 0.0)
return;

//Applydamage
hitPoints -= damage;
audio.PlayOneShot(painSound, 1.0 / audio.volume);
time = 2.0; 


//Arewedead?
if (hitPoints <= 0.0){
hitPoints=0.0;
Die();
PlayerIsDead = true;
Debug.Log ("PlayerDied");
 }
}

//PickingupMedicKit
functionMedic (medic : int){

hitPoints += medic;

if(hitPoints > maxHitPoints)
hitPoints = maxHitPoints;
}

functionDie () {
if(callFunction)
return;
callFunction = true;

if (die && deadReplacement)
AudioSource.PlayClipAtPoint(die, transform.position);

//Disableallscriptbehaviours (Essentiallydeactivatingplayercontrol)
varcoms : Component[] = GetComponentsInChildren(MonoBehaviour);
for (varbincoms) {
varp : MonoBehaviour = basMonoBehaviour;
if (p)
p.enabled = false;
 }
//Disableallrenderers
vargos = GetComponentsInChildren(Renderer);
for( vargo : Rendereringos){
go.enabled = false;

 }
if(radar != null){
radar = gameObject.FindWithTag("Radar");
radar.gameObject.SetActive(false);
 }
Instantiate(deadReplacement, transform.position, transform.rotation);
//yieldWaitForSeconds(4.5);
//LevelLoadFade.FadeAndLoadLevel(Application.loadedLevel, Color.black, 2.0);
}


functionOnGUI () {
GUI.skin = mySkin;
varstyle1 = mySkin.customStyles[0];
GUI.Label (Rect(40, Screen.height - 50,60,60),"Health: ");
GUI.Label (Rect(100, Screen.height - 50,60,60),"" +hitPoints, style1);
if (PlayerIsDead == true)
 {
if (GUI.Button(Rect(Screen.width*0.5-50, 200-20, 100, 40), "Respawn"))
 {
RespawnPlayer();
 }
if (GUI.Button(Rect(Screen.width*0.5-50, 240, 100, 40), "ExittoMenu"))
 {
Debug.Log ("ReturnToMenu");
 }
GUI.color = Color(1.0, 1.0, 1.0, alpha); //Color (r,g,b,a)
GUI.DrawTexture(newRect(0,0,Screen.width, Screen.height), damageTexture);
}
}
functionRespawnPlayer ()
{
Debug.Log ("RespawnPlayer");
}

//functionDead ()
//{
//PlayerIsDead = true;
//Debug.Log ("PlayerDied");
//}
//

functionExploasion(){
explShake.animation.Play("exploasion");
}

why are you not putting spaces between words? like function (space) PlayerDamage or var (space) hitPoints ?

i have, i dont know why its not showing up on the forum o.0

I think you have to click the insert button now, rather than typong code tags manually, or it’ll end up weird.

As far as I can tell RespawnPlayer() doesn’t actually do anything :slight_smile: