Show matrix fields based on quantity [Sprig]
The problem that you expect your qty variable to be an array of guests and initialize it like that, but once you set a quantity it will be an integer, so the loop won't work correctly. See this line:
{% set qty = qty ?? [['']] %}

This initializes qty to an array containing another array containing an empty string (by the way, why do you need the nested array? Wouldn't a simple array of guest names suffice?). But once you select a quantity, the qty variable will simply be an integer (or numeric string, not sure). A for-loop expects an iterable (array or iterable object), so your for-loop is invalid:
{% set qty = 3 %}

{# this is invalid #}
{% for guest in qty %}
    {# this will never be reached #}
{% endfor %}

Instead of qty, what you want is a guests variable which holds a number of items in your expected format (in this case, arrays of strings) corresponding to the selected quantity. For example:
{% set qty = qty ?? 1 %}
{% set guests = range(0, qty - 1)|map(i =&gt; ['']) %}

{% for guest in guests %}
  &lt;input sprig type=&quot;text&quot; name=&quot;options[guests[{{ loop.index0 }}][0]]&quot;&gt;
{% endfor %}

Note this will reset the values in the guest input fields whenever the quantity is changed. You'd need to retrieve the current inputs as well to set the current values of the input fields as well.