Display the number of hits in a gui button when an object/player hits another object which is an obstacle

How to display the number of hits in a gui button when an object/player hits another object which is an obstacle in a game?

Sounds like you need to still learn the basics of Unity.
Do the tutorials here

Then go to www.unity3dstudent.com and do all the scripting tutorials there.
Once you’ve done those you can write your own scripts.

If you have a specific problem you need help on, then you can ask us here.