gui for counting the HIT count?

How to count the number of HITS in an object using GUI button?

While I obviously can’t know exactly what your variable names are, or how your program is structured, I can give you this much at least:

if(GUILayout.Button("Hits: " + numberOfHits))
{
    numberOfHits++;
}

Of course, this isn’t a counter. I don’t think you can count hits using a GUI button, unless they are created whenever the user presses it.