Loop on a script

I would use an automation and a time_pattern trigger instead of a script:

- id: 'Cycle colors'
  alias: Cycle colors
  initial_state: true
  trigger:
    - platform: time_pattern
      seconds: '/1'
  condition:
    - condition: state
      entity_id: input_boolean.start_light_show_1
      state: 'on'
1 Like