Struggle with ESP8266 toy

I’m building a toy for my sons 2nd birthday. it will be an wall hanged activation board with electronic features.

I have three buttons they will do different things.
if i press button one of the 3 buttons i whish to disable the three buttons so that i don’t trigger the same script or another simultaneous.

1 i have tried to do this with a binary_template_switch but i cant make it work
2 i have solved the problem with a gpio switch but i dont whis to waste a GPIO
3 when i added the solution gpio solution i cant get the repeat to work anymore.

does anyone have a better way to the blocking of simultaneous scripts?
what is wrong with the GPIO version why did the repeat stop working?

switch:
- platform: template
  id: modebutton
  optimistic: true

- platform: gpio
  id: modebutton1_trafficlight

 ` on_press:
      then:
          if:
              condition:
                lambda: 'return id(modebutton).state = "0";'
                then:
#With a regular switch (works)
binary_sensor:
- platform: gpio
  name: modebutton1_trafficlight
  pin:
    number: D1
    mode: INPUT_PULLUP
    inverted: True
  on_press:
      then:
        - if:
            condition:
              switch.is_off: modebutton
            then:
              - repeat:
                count: 5
                  then: #(line 79)
                    - switch.turn_on: modebutton
                    - switch.turn_off: ledyellow
                    - switch.turn_off: ledgreen
                    - delay: 7s
                    - switch.turn_off: ledred
                    - switch.turn_on: ledyellow
                    - delay: 2s
                    - switch.turn_off: ledyellow
                    - switch.turn_on: ledgreen
                    - delay: 7s
                    - switch.turn_off: ledgreen
                    - switch.turn_on: ledyellow
                    - delay: 4s
                    - switch.turn_off: ledyellow
                    - switch.turn_off: ledred
                    - switch.turn_off: modebutton
ERROR Error while reading config: Invalid YAML syntax:

mapping values are not allowed here
  in "/config/esphome/esp-008-activationboard-v2.yaml", line 79, column 23:
                      then:
                          ^

Thanx in advance for your time!

count: should be indented the same amount as then:. See the example here: Automations and Templates — ESPHome

              - repeat:
                  count: 5
                  then:

Thanx for your reply!
I will try this when i come home.
Quite shure i have tried it… (copied straight from the dokumentation at one point) i have tested some diffrent ways to do the indentation.

it could be pebkac…