ListBox on click

Hello guys. I tried to override a function on ListBox, but is not working



ListArmas.DoClick = function()
		chat.AddText( Color( 0, 255, 0 ), "[Clã | BR]", nickteamcolour3, name3, Color( 255, 255, 255 ), " Selecione algo antes de comprar" )
		if string.match(selecao, "Armas de fogo") != nil then
			for k, v in pairs(WeaponsTable) do
				SetLabelText(v.WeaponName, selecao)
			end
		elseif string.match(selecao, "Armas de explosão") != nil then
			for k, v in pairs(ExplosionTable) do
				SetLabelText(v.WeaponName, selecao)
			end
		else
			for k, v in pairs(MeleeTable) do
				SetLabelText(v.WeaponName, selecao)
			end
		end
	end


How can I do to change a Label when I selected an Item on my Listbox?

LabelName:SetText not SetLabelText. IDK if this is wrong because all I use that more often than anything else.

SetLabelText is a function that I created. What I wanna know is how can I “hook” the doClick function on a list box, than get the selected Item

ListBox.DoClick = function()

in my code I did this, but didn’t hook the event

You have ListArmas.DoClick = function(), does that match to the vgui element you’re clicking?

Yes, I created a ListBox, add items in there, then hook the DoClick function, but when I try to select an Item on ListBox, nothing happens