Floating Damage Numbers Not Appearing Over Enemies

I am following a simple RPG tutorial on youtube, since I’m a complete beginner. I’m trying to get floating damage numbers to appear over the enemy when the player hits them. The numbers appear in the top right hand corner of the screen every time I hit one. I made sure that the canvas render mode is set to world space. I checked other threads and the solutions were too advanced for me to understand. Here is the script for HurtEnemy:

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

public class HurtEnemy : MonoBehaviour
{
    public int damageToGive;
    public GameObject damageBurst;
    public Transform hitPoint;
    public GameObject damageNumber;

    // Start is called before the first frame update
    void Start()
    {
       
    }

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

    }       
   
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Enemy")
        {
            //Destroy(other.gameObject);
            other.gameObject.GetComponent<EnemyHealthManager>().HurtEnemy(damageToGive);
            Instantiate(damageBurst, hitPoint.position, hitPoint.rotation);
            var clone = (GameObject) Instantiate(damageNumber, hitPoint.position, Quaternion.Euler(Vector3.zero));
            clone.GetComponent<FloatingNumbers>().damageNumber = damageToGive;
            clone.transform.position = new Vector2(hitPoint.position.x, hitPoint.position.y);
        }
    }

}

And the scriptI have for FloatingNumbers:

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

public class FloatingNumbers : MonoBehaviour
{
    public float moveSpeed;
    public int damageNumber;
    public Text displayNumber;

    // Start is called before the first frame update
    void Start()
    {
       
    }

    // Update is called once per frame
    void Update()
    {
        displayNumber.text = "" + damageNumber;
        transform.position = new Vector3(transform.position.x, transform.position.y + (moveSpeed * Time.deltaTime), transform.position.z);
    }
}

I copied the tutorial exactly, and it works in the video, but I feel like I’ve tried everything and I can’t get it to work.

It sounds like there is a step missing. Specifically I think line 33 has to be some kind of computation to take it from the world coordinates in hitPoint.position into the scale mode of your canvas.

The Camera has functions to get you into screen space, and this class has functions to get you into Canvas space.