No respawn.

This is my script

public class FirstPersonCharacterScript : MonoBehaviour {
public int lives = 3;
    public Transform respawn;
    public Transform fireFXFlameBall01;

    // Use this for initialization
    void Start () {
   
    }
   
    // Update is called once per frame
    void Update () {
   
    }
    void OnTriggerEnter (Collider other)
    {
        if (other.transform == fireFXFlameBall01)
        {
            transform.position = respawn.position;
            lives -= 1;
        }
    }
}

I created an empty object, this to make my FirstPersonCharacter to get to this place when it collides with the fireFXFlameBall01.
The Lives do count -1, so that works, but the respawn to the empty object doesn’t work.

have you tried printing the respawn position and transfrom position to check?

Use:

if (other.gameObject.name == fireFXFlameBall01)
        {
            transform.position = respawn.position;
            lives -= 1;
        }

Can you help me with that.

@ , youre answer doesn’t work, the name isn’t allowed.

What Laperen is trying to say is try using Debug.Log() to check if the transform.position and respawn.position are in fact the same, something like: Debug.Log (transform.position + "/" + respawn.position); This would tell you that you in fact are getting the respawn you just dont notice it.

My bad I gave you the wrong code, what I meant to give you was this:

if (other.gameObject.name == "fireFXFlameBall01")
            {
                     //do stuff
            }

This required the fireballs name to be fireFXFlameBall01 exactly.

Another option you could think about is using tags, if you created a fireball tag for your fireball then you could use:

if (other.gameObject.tag == "fireball")
            {
                     //do stuff
            }

For more information on tags see http://docs.unity3d.com/Manual/Tags.html.

The Debug told me that I was staying on the same place, so I tried another code:

void OnTriggerEnter(Collider other)
{
if (other.transform == fireFXFlameBall01)
{
Debug.Log (transform.position = new Vector3(0,1,0));
lives-=1;
}

The Debug.Log says that the position changes to 0,1,0 like the script says, but the object FirstPersonCharacter doesn’t move to that place.
Still the problem is there, how to fix this?

Debuging a new position doesnt change the transforms position, maybe try actually changing the position.

By removind the debug, still it doesn’t work.
Hopefully there is a way to make this work, I can’t.

Changed the code again, and still only lives is -1 and no return to basic.

void OnTriggerEnter (Collider col)
    {
        if (col.tag == "FireFXFlameBall01")
        {
            transform.position = new Vector3(0,1,0);
            lives -= 1;
        }
    }

Should this be the problem:
There are inconsistent line endings in the ‘Assets/FirstPersonCharacterScript.cs’ script. Some are Mac OS X (UNIX) and some are Windows.
This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.

May I suggest that you take a look at the learn section, there are plenty of tutorials that would show you how to fix simple problems like the one you are having.