`getMusicPlaying` is set to false whenever someone touches the button, but libgdx runs `show` method only once, at the start of the game, hence the music will keep playing forever.

I tried to use the `render` and `batch.begin` instead of `show()` same result.

    private boolean musicPlaying = true;
    
    button.addListener(new InputListener() {
    public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
     return true;
    }
    
    public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
     setMusicplaying(!musicplaying);
    }
    });
    
    }
    });
    }
    
    public void show() {
     if (getMusicPlaying ==true)
      music.play();
    }