I need script to cycle RGB light each time it runs (16 Colors )

type or paste code here

Perhaps ask in the configuration section for help and show what you’ve tried. This section is typically for complete working implementations.

Indeed not the correct forum section, maybe a mod can move this post?

I use the following automation. For me it cycles through a pre-defined list of colours (as set as a helper) every 10 minutes. In your case you could change the trigger to your light switching on

alias: RGB buiten loop
description: ''
trigger:
  - platform: time_pattern
    minutes: /10
condition:
  - condition: state
    entity_id: light.buiten_tuin_spots
    state: 'on'
action:
  - service: light.turn_on
    target:
      entity_id: light.buiten_tuin_spots
    data:
      color_name: '{{ states(''input_select.light_colour'') }}'
      transition: 30
  - service: input_select.select_next
    target:
      entity_id: input_select.light_colour
mode: single

For the rgb colours:

input_select:
  rgbkleur:
    name: "rgbkleur"    
    options:
      - aquamarine
      - blue
      - blueviolet
      - cadetblue
      - chartreuse
      - coral
      - orange
      - darkorange
      - tomato
      - orangered
      - red
      - crimson