So I got an simple code that when I click it ads one to my score for an clicker game but when I click on the button it works once not twice or more.

What I want is that I can click multiple times.
I tried adding it to _process(delta) but that showed me an error.
Does anyone know how to fix this?
Thanks.

  • Jesusemora replied to this.
  • Using _process here is a very bad idea. Move the code into the _on_button_pressed function.

    Your actual problem is the assignment in _on_button_pressed. You want += 1, not = +1.

    foxycodes I click on the button it works once not twice or more.

    Sounds like you did something wrong when... connecting the signal??? How exactly did you do this? show code or screenshots?
    I can only DEDUCE so much. the ways I can think of to connect a signal are from the signal panel next to the inspector, and from code. For the first we need a screenshot to diagnose a problem, for the second we need the code.

    foxycodes I tried adding it to _process(delta) but that showed me an error.

    adding what?
    I recommend that you read the docs or follow some tutorial before jumping to code if you have no experience with godot or coding in general.

      Jesusemora Sorry for late reply. I have experience with godot and even with gd script, but mainly in godot 3. Where it worked I connected it from the inspector. I meant the function process(Delta) and I tried more options but no one worked.

      Using _process here is a very bad idea. Move the code into the _on_button_pressed function.

      Your actual problem is the assignment in _on_button_pressed. You want += 1, not = +1.