Cannot use triggers to teleport an object?

This is my script:

using UnityEngine;
using System.Collections;

public class screenbottom : MonoBehaviour {



	

	void OnTriggerEnter(Collider2D col)
	{
		if(col.gameObject.tag == "screenbottom")
		{
			transform.position (GameObject.FindWithTag ("screentop"));
		}
	}

}

The end goal is to enable an object to fall off the bottom of the screen and continue on through to coming back down from the top infinitely. I have set ‘screenbottom’ and ‘screentop’ as ‘is Trigger’, given them both rigidbody2d and coinciding tags. I cannot imagine why this isn’t working but I am new to much of this. Perhaps using entering triggers is not the best idea in the first place? Due to the specificness of using one spawn-point, I can’t even imagine how one would expand on this script to allow for the players position to still continue forwards while falling. Any help is super appreciated.

You are trying to use transform.position as a method which doesn’t exist.

To change the position of the game object that this script is connected to that object should be done like this:

using UnityEngine;
using System.Collections;

public class screenbottom : MonoBehaviour {
    //This script must be attached to your player that moves.

    public Transform screentop;
    //This is a public Transform, soo we can assign this object the transform of the screentop
    //object in the editor, making it much easier to change!

    void OnTriggerEnter2D(Collider2D col) {
    //This needs to be OnTriggerEnter2D as we are using 2D colliders

        if (col.gameObject.tag == "screenbottom") {
            Debug.Log("Screen bottom found, moving position to y: " + screentop.position.y);
            //Here we set the y in the transform to the y of the screentop object, thus
            //making sure the character can still move along the x axis (soo we set the x as what it already was to get that behaviour)
            transform.position = new Vector2(transform.position.x, screentop.position.y);
        }
    }

}