Player Respawn Bug

I’m creating a sequence were I destroy the player if their health is 0 and respawn a prefab of the player back at the spawn point. Destroying the player works fine, but it is spawning a stream of player prefabs about 1 per frame, and it is not waiting for the player to be destroyed before it begins spawning. Below is my code. Where am I going wrong?

        public int Health = 100;
	public Transform PlayerPrefab;
	
	
	// Update is called once per frame
	void Update () {
		
		if(Health <= 0)
			Destroy(GameObject.FindGameObjectWithTag("Player"));
		
		if(GameObject.FindGameObjectWithTag("Player") == null);
			Instantiate(PlayerPrefab, GameObject.Find("PlayerSpawnPoint").transform.position, Quaternion.identity);
		
	}

I haven’t actually studied Unity scripting yet, but I’ll take a stab anyway.

Is the PlayerPrefab you’re spawning tagged as “Player”?

Edit: Actually, reading the code a little better, and with you saying the Destroy command is working fine but it’s not even waiting for the “Player” to be destroyed, my theory is moot as there is obviously something tagged as “Player” at some point in this process.

Edit2: Ok, maybe this is the problem:

My guess is that should probably be:

Note the removal of the semi-colon from the end. Once again, I haven’t actually started scripting in Unity yet, but it seems as if you’re closing the ‘if’ statement before you get to your ‘spawn’ part of the script. So the ‘spawn’ part has nothing to do with the ‘if’ statement and is instead just constantly spawning ‘PlayerPrefab’.

Sorry if none of this was helpful.

the semi colon definitely needs to go, also reset the health to 100 when he is respawned. (preferably before you reInstantiate him)

I am still having issues getting an instance of the player to respawn. Below is the complete code that I am using

using UnityEngine;
using System.Collections;

public class HealthSphere : MonoBehaviour {
	public int maxHealth = 100;
	public int Health = 100;
	public Transform PlayerPrefab;
	
	public float healthBarLength;
	
	

	// Use this for initialization
	void Start () {
		healthBarLength = Screen.width / 2;
		
		
	
	}
	
	// Update is called once per frame
	void Update () {
		AdjustCurrentHealth(0);
		
		if(curHealth <= 0)
			Destroy(GameObject.FindGameObjectWithTag("Player"));
			
		if(GameObject.FindGameObjectWithTag("Player") == null)
			Instantiate(PlayerPrefab, GameObject.FindGameObjectWithTag("PlayerSpawnPoint").transform.position, Quaternion.identity);
			Health = maxHealth	
		
		
		
	}
	
	void OnGUI(){  
		GUI.Box(new Rect(10, 10, healthBarLength, 20), curHealth + "/" + maxHealth);
	}
	//Component called in Attack script
	public void AddjustCurrentHealth(int adj) {
		curHealth += adj;
		
		if(curHealth < 0) 
			curHealth = 0;
		
		
		if(curHealth > maxHealth)
			curHealth = maxHealth;
		
		if(maxHealth < 1)
			maxHealth = 1;
		
		healthBarLength =(Screen.width / 2) * (curHealth / (float)maxHealth);
	}
}