How can i use transform.position to a gameobject in an array?

using UnityEngine;
using System.Collections;

public class Teleport : MonoBehaviour {
public GameObject otherPortal;
void Start () {
otherPortal = GameObject.FindGameObjectsWithTag (“portal”);
}

void Update () {

}
void OnTriggerEnter2D(Collider2D other) {
Debug.Log (“Hit the portal”);
if (other.tag == “Player”) {
other.transform.position = otherPortal.transform.position;
}
}
}

Hey,

If you remember well, Array have index.
so, for exemple myArray[1].

I think you just forget to put the index for the portal.
Normely it will be this:

other.transform.position = otherPortal[1].transform.position;

Try this and tell me if it’s works ! :slight_smile: