Assuming your Text object is a proper Text object with a property named ‘Text’
Give it an always sensor and link it to a property actuator, set it to copy a property from the character object(call it say, ‘hit’) to it’s own ‘Text’ property.
Put a property on the character called ‘hit’.
Put another property on the cube.(say, ‘cube’)
Put a collision or near sensor on the character, set this to read ‘cube’ in the property line, Then link this to a property actuator, set this to add 1 to the ‘hit’ property.
This will add 1 to the property ‘hit’ and the Text object will copy this to its ‘Text’
If you have any problem with the Text object, just append one from someone else’s game.
Hope this makes sense! It’s hard to explain in words with no pictures.
There should be a tutorial for it somewhere but I can’t remember where.