How to show item name when you pick it up

Here is my current script. I need create script(with properties) so when i pick up item it must display it name on UI text. But my current script doesent work,how to solve it? (i must use properties)

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

public class BaseItem : MonoBehaviour
{
    private Collider Other;

    private string _name;
    public string Name
    {
        get
        {
            return _name;
        }
        set
        {
            value = Other.gameObject.tag;
            _name = value;
        }
    }
    public TMP_Text displaytext;

    public void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Item"))
        {
            Other = other;
            BaseItem item = new BaseItem();

            displaytext.text = item.Name;
            Destroy(Other.gameObject);
        }
    }
}

In your BaseItem class (which should manage all objects that are “Items” i guess) you check if the collider that enter has an “item”-tag, shouldn’t it be the other way around?

Also are you getting any errors? Is that script on an object (you item) that has a collider which is marked as a trigger?

You’re also creating a new BaseItem() which is a MonoBehaviour, that is not allowed. If the player collects the item, you probably want to destroy the item by using Destroy(gameObject). The script only works correctly if ALL compiler errors are fixed. If it’s still not working, I suggest using Debug.Log() on every step of your script, so you can observer where your codes runs when doing certain actions.