Elevator script problem

I did this script for an elevator and I have a problem with it. This script should be added to the trigger the player should touch for the elevator to move. I want to make it stops when the position is equal to the floor2 position but it just seems to go on. What should I do

using UnityEngine;
using System.Collections;

public class BasicElevator : MonoBehaviour {
	public bool _isTriggered;
	public Transform elevatorBody;
	public Transform floor1;
	public Transform floor2;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if(_isTriggered){
			elevatorBody.transform.Translate(Vector3.up * Time.deltaTime * 10);
		}
		if(elevatorBody.transform.position == floor2.transform.position){
			_isTriggered = false;
			Debug.Log("Floor2");
		}
	}
	
	void OnTriggerEnter(Collider other){
		if(other.CompareTag("Player")){
			_isTriggered = true;
		}
	}
}

not sure how you are testing it… ie, if you are remaining on the trigger etc…but…

one quick thing that jumps out is maybe the elevator is never actually getting to the EXACT height of the floor (this could be to the floating point etc)…try changing:

if(elevatorBody.transform.position == floor2.transform.position){

to

if(elevatorBody.transform.position >= floor2.transform.position){

Regards,
Matt.

Hey thanks it worked great! Ive just changed it to

if(elevatorBody.transform.position.y >= floor2.transform.position.y){

and it worked perfect!

Thanks again!