Clear the text in display.newText to display the results of a counter

In the code below when tally(hit) calls the tally function a counter number is displayed BUT when the function is called again the previous number does not disappear but rather is displayed on top of the previous number.

for example at first 1 is displayed but when it is time to display 2 it is put on top of 1. How can I display the numbers one at a time so the user would see a counter 1 then 2 etc.
function tally (score)
local t = display.newText(“0” , 90, 15, “ArialRoundedMTBold”, 20 )
t:setTextColor( 250, 250, 250 )
t.text = score
end
–***********************
hit = hit + 1

tally( hit)
[import]uid: 22152 topic_id: 6376 reply_id: 306376[/import]

It’s because you keep calling newText() inside the function. Call it just once at the top of your code and don’t keep creating it over and over. [import]uid: 12108 topic_id: 6376 reply_id: 22045[/import]

But how do I show the counter number? What would the call be? [import]uid: 22152 topic_id: 6376 reply_id: 22046[/import]

Just change the text on the counter; the display changes automatically.

[code]
local t = display.newText(“0” , 90, 15, “ArialRoundedMTBold”, 20)
t:setTextColor(250, 250, 250)

local function tally(score)
t.text = score
end

hit = hit + 1

tally(hit)
[/code] [import]uid: 12108 topic_id: 6376 reply_id: 22048[/import]

I was having the same issue. Thanks for the suggested work around. [import]uid: 30914 topic_id: 6376 reply_id: 28125[/import]