setParameter returning a nil value

I’m trying to change the displayed unit on a knob from the default value of the parameter. But unfortunately, I get a script error on the setParameter. Not sure what I’m doing wrong.

function onRateChanged ()
  local zones=this.parent:findZones(true)
  for i, zone in ipairs(zones) do
    zones:setParameter(3604510, RateLFO)
    if RateLFO <= 4 then
      RateUnitDisplay = '1/1'
    else if (RateLFO >= 5 and RateLFO < 12) then
      RateUnitDisplay = '1/2'
    end
  end
end

defineParameter('RateLFO', 'Rate LFO', 0, 0, 100, 1, onRateChanged)
defineParameter('RateUnitDisplay', nil, '')
onRateChanged()

I appreciate any help on this!

Try zone:setParameter instead of zones:setParameter.

Doh, dumb mistake. Thanks for catching that.
What is odd is it doesn’t seem to display what i’m instructing when attaching it to the knob. The knob still shows the 0-100 values. i’m attaching the RateLFO to the value and I tried attaching the RateUnitDisplay to Unit, but perhaps I’m completely misunderstanding how that is supposed to translate.

You probably need to edit the knob template and export the text control separately. By default both knob and text are exported using same variable “Value”. Which is what you want most of the time.

But in your case you want to connect the knob to one parameter and the text to the other.