How can i make my game object not clickable?

i have this script where i click on my cubes and they turn to their respective color, but i can also change to the ball color and i dont want that. is there a way to make my ball unclickable? i’ve tried this so far but no success

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

public class ChangeBallColor : MonoBehaviour
{
    [SerializeField] GameObject ball;
    [SerializeField] Material ballMaterial;
    [SerializeField] Material cubeMaterial;

    // Start is called before the first frame update
    void Start()
    {
        Debug.Log(FindObjectOfType<ChangeBallColor>().gameObject);
    }

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

    private void OnMouseDown()
    {
        if (EventSystem.current.IsPointerOverGameObject() == false)
        {
            ballMaterial.color = cubeMaterial.color;
        }

        if(ball)
        {
            return;
        }
    }
}

You could use tags or some other way to detect the object type you want to interact with.
And if you have a script that reacts to mouse clicks, don’t add it to the ball?