I need to create a search bar that will filter out a bunch of Image Buttons.Here's what I have tried so far of of Youtube. Can someone please help me create this featue? I lack understanding of actual coding.
SearchResults = script.Parent.Parent.ItemContainer.SearchResults
function Display(Items)
for i,v in pairs(items) do
v.Visible = true
end
end
function Search(Text)
local List = {}
for _,v in pairs(SearchResults:GetChildren()) do
if v:IsA('ImageButton') and v.Text:find(Text) then
List[#List+1] = v
end
end
return List
end
script.Parent.SearchBar.Changed:Connect(function(Value)
if Value == "Text" then
local list = {}
for i,item in pairs(SearchResults:GetChildren()) do
if item:IsA('ImageButton') then
item.Visible = false
list[#list+1] = item
Display(Search(SearchResults.Text))
end
end
end
end)
Project Structure~
http://imageupper.com/i/?S1200010060023B15954624131195290 http://imageupper.com/i/?S1200010060013B15954624131195290 http://imageupper.com/i/?S1200010060033B15954624131195290 http://imageupper.com/i/?S1200010060043B15954624131195290 http://imageupper.com/i/?S1200010060053B15954624131195290 http://imageupper.com/i/?S1200010060063B15954624131195290
