The knob is not responding using Script

Hi,
Is there anything missing in the below code?

The code is working fine, it has one issue:

If I played any key (even if its the same key) while I’m holding the knob, the knob will not respond anymore, I have to release it and hold it again!

defineParameter("zoneScope", nil, "")
defineParameter("zoneName", nil, "")

function updateSampleDisplay(note)
	local zones = this.parent:findZones()
	for i, zone in pairs(zones) do
		if note >= zone.keyLow and note <= zone.keyHigh then
			zoneScope = "@0:Samples/@0:"..zone.name.."/"
            zoneName = zone.name
			break
		end
	end
end

function onNote(ev)
	updateSampleDisplay(ev.note)
	postEvent(ev)

end

I figured it out , just I needed to add an if condition in the updateSampleDisplay function:


defineParameter("zoneScope", nil, "")
defineParameter("zoneName", nil, "")


function updateSampleDisplay(note)
	if current ~= note then
		--print(note, " " ,current)
		current = note
		local zones = this.parent:findZones()
		for i, zone in pairs(zones) do
			if note >= zone.keyLow and note <= zone.keyHigh then
				zoneScope = "@0:Samples/@0:"..zone.name.."/"
				zoneName = zone.name
				--print("zoneScope : ", zoneScope, "  |  zone.name : ", zone.name)
				break
			end
		end
	end
end

function onNote(ev)
		updateSampleDisplay(ev.note)
		postEvent(ev)
end