I'm creating a search bar in my Gui and I wanted to add a feature where you can search for multiple string of text my separating them with commas and it keeps returning this error at line 21: attempt to index field '?' (a nil value)
This is the full script:
SearchBar = script.Parent Input = SearchBar.Input Items = SearchBar.Parent.Items Input:GetPropertyChangedSignal("Text"):Connect(function() if Input.Text:match(",") == nil then for i,v in pairs(Items:GetChildren()) do if v:IsA("TextLabel") then if v.Name:lower():find(Input.Text:lower()) then v.Visible = true else v.Visible = false end end end else local SearchFor = Input.Text:split("," or ", ") for i = 1, #SearchFor do for i,v in pairs(Items:GetChildren()) do if not v:IsA("UIListLayout") then if v.Name:lower():match(SearchFor[i]:lower()) then v.Visible = true print("yes") else v.Visible = false print("no") end end end end end end)