Why don't my fireballs get destroyed when I hit a wall?,How do I destroy my projectile when it hits a wall?

So I’m making a game where you are a wizard that fires fireballs. The fireballs have a script:

`

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveTrail : MonoBehaviour
{
    public int moveSpeed = 15;
    void Update()
    {
        transform.Translate(Vector3.right * Time.deltaTime * moveSpeed);
        Destroy(gameObject,1);
    }
    void OnCollisionEnter(Collision collision)
    {
        Destroy(gameObject);
    }
}

I want them to get destroyed when they hit a wall but now they just stop at the wall and slide to the side. They have a rigidbody2d and a box collider. They are made from a sprite and a trail, which are children of the fireball. I have checked every forum question that I could find and they all said the same thing.
I am sorry if this is just a little mistake but it’s my first time using Unity. Thanks for help

Apparently my fireball prefab was wierd. I made a new one and i did the code completely different and now it works. Thanks for the help anyway