I made some changes and simplified the code for you. You will need to set the collider on the Teleporter as a trigger and then drag in the object that you want your destination to be as well as your player character.
using UnityEngine; using System.Collections;
public class playerTeleport : MonoBehaviour {
using UnityEngine;
using System.Collections;
public class playerTeleport : MonoBehaviour {
bool isInRange = false;
public Transform destination;
public GameObject player;
void Update()
{
if (isInRange)
{
if&& (Input.GetKeyDown(KeyCode.E))
{
Teleport();
}
}
}
void OnTriggerEnter (Collider other)
{
if(other.gameObject == player)
{
isInRange = true;
}
}
void OnTriggerExit (Collider other)
{
if(other.gameObject == player)
{
isInRange = false;
}
}
void Teleport()
{
player.transform.position = destination.position;
}
}