Based on docs it seems like you need to instantiate the Text
object outside of the update
loop. This will draw it to the screen "forever" until you call the remove
method.
In your current code you are just instantiating a new object every time, and Ruby 2D is secretly keeping it around even though you don't have it assigned to a variable.
Unlike some other 2D libraries like Gosu, Ruby 2D does not stop drawing something until you explicitly tell it to.
Try
@text = Text.new("Score: #{@score}")
update do
...
@text.remove # At a time you want to stop displaying that text.
...
end
Adding and removing objects in Ruby 2D