How do i "Lock" a platform in place?

I’ve tried setting the Rigidbody velocity to a Vector3.zero (on the TriggerExit function) , yet the platform keeps going up into the infinite no matter what i write to lock it down, i wanted to lock the platform in place once it has reached a certain point in the Y axis - so that it could only fall down once the player no longer pressed the button to keep the platform up. As you can see i’m a complete beginner - i hope i’ve been clear enough. Thanks, any help is appreciated - if i can be more clear let me know.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ElevatorButton : MonoBehaviour

{
     
     //public GameObject Elevator;
    public GameObject elevator;
    private Rigidbody rb;
    public float speed;
    float stop;

    //bool isActivated = false;

    private void Awake()
    {
        rb = elevator.GetComponent<Rigidbody>();
    }

    void OnTriggerStay(Collider col)
    {
        
        if (col.gameObject.CompareTag("Player"))
        {
            rb.useGravity = false;
            rb.velocity = transform.up * speed;
            Debug.Log("ahahah");

        }
      
    }



    void OnTriggerExit(Collider col)
    {
        if (col.gameObject.CompareTag("Player"))
        {
            
            rb.useGravity = true;
           
        }
        

    }



}

-1. you need to reset the velocity after ontriggerstay => rb.velocity = Vector3.zero;

-2. are you sure that you want to multiply the velocity by time, every frame? this will result in an increasing speed of your platform… just if you want a constant upspeed you want to set the velocity to a fixed value, like rb.velocity = new Vector3(0,10,0);