Instantiate an object with a text following it?

As the title said.

This is my showtext script.

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

public class ShowText : MonoBehaviour
{

    public static Text myText;
    public static ShowText Texting;
    public AIBulletG green;
    public AIBulletR red;
    public bool showText;
    public float showDuration;
    // Start is called before the first frame update
    void Start()
    {
        myText = GetComponentInChildren<Text>();
        Texting = this;
        showDuration = 5f;
    }

    // Update is called once per frame
    void Update()
    {


        if (!AIBulletG.bullet.dead) {
            gameObject.transform.position = new Vector2(AIBulletG.bullet.transform.position.x, AIBulletG.bullet.transform.position.y + 0.15f);
        }
        if (!AIBulletR.bullet.dead)
        {
            gameObject.transform.position = new Vector2(AIBulletR.bullet.transform.position.x, AIBulletR.bullet.transform.position.y + 0.15f);
        }
    }
}

I have my text coded in my bullet as well.
with this.

        ShowText.myText.text = hp.ToString();

I also get error saying object is destroyed and file still trying to access it.
Is it possible to instantiate the text on the spawned object?

As it says, whenever you’re running that code, the text object has been destroyed. So, when is that code being run? Has the “ShowText” object (and therefore, its children) been destroyed at some point?

Isnt the text must be under canvas to work?