Your render method already does clear the screen (about 60 times per second):
@Override
public void render(SpriteBatch sb) {
Gdx.gl.glClearColor(100f, 100f, 100f,1.0f);//sets the clear color to gray
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);// CLEARS THE SCREEN
Buttons.setUp(sb, font, img, gsm);
sb.draw(img, 170, 700, 180, 140);//draws the button again
font.draw(sb, "to hobby", 225, 705);//draws the text on the button again
}
So the problem probably is something else. It’s probably a good idea to create a new question to find the cause of the problem (include a description of what happens when “it automatically ends”, exceptions or errors that are shown in the console output, and if possible a minimal reproducable example)
CLICK HERE to find out more related problems solutions.