How to make a searchbar

I am making a mining game using berezaa’s infinite mining kit and my question is how do I create a search bar which can Search depending on the name of the item on which the data is generated, so it’s basically looking for a name inside a frame, I’d love if you could help me :heart:
eg: Sampleitem.ItemName (find item name)

--Var
local Scroll = script.parent.Inventory.Items
local searchbar = script.parent.Inventory.Searchbar.Textbox
--
function UpdateInputOfSearchText()
	local InputText=string.upper(searchbar.Text)
	for _,button in pairs(Scroll:GetChildren()) do
		if button:IsA("TextButton") then
			if InputText == "" or string.find(string.upper(button.Name),InputText) ~= nil then
				button.Visible = true
			else
				button.Visible = false
			end
		end
	end
end
searchbar.Changed:Connect(UpdateInputOfSearchText)

image

1 Like

Use string.match and make it loop through all the items in the inventory with for i,v loop