- Home /
Spawn player if player dead
so I made this Java Script to spawn the player if the players tags weren't found only problem is it spawns the player no matter what. could someone tell me what I'm doing wrong?
var projectile : GameObject;
function Start()
{
GameObject.FindGameObjectsWithTag("Player2");
}
function Update()
{
if (GameObject.FindGameObjectsWithTag("Player2")==null);
{
Instantiate(projectile, transform.position, transform.rotation);
}
}
not quite clear on what the problem is. are you saying it continually spawns a player each update? non-stop?
Answer by zee_ola05 · Feb 17, 2014 at 04:51 AM
Remove the semicolon here:
if (GameObject.FindGameObjectsWithTag("Player2")==null);
Answer by abi-kr01 · Feb 17, 2014 at 06:12 AM
if should not have ; thing in syntax
if (GameObject.FindGameObjectsWithTag("Player2")==null);
it should be something like
if (GameObject.FindGameObjectsWithTag("Player2")==null)
{
}
Yup, got it. I fxed it by just making a new script with different actions.
$$anonymous$$ark it as answered so that it won't show in unanswered question tab
Your answer
Follow this Question
Related Questions
How do I create a spawn point 2 Answers
Using player as prefab ? 1 Answer
make player that enters collider tagert 1 Answer
How can i set my script on loop (JS) 1 Answer
Player Spawn problems 2 Answers