Hi! I’m working on a search bar and i noticed that if someone types a Square bracket or even a normal bracket, i get a bunch of errors such as: malformed pattern (missing ']')
is there any way to detect and prevent this from happening?
code snippet:
SearchBar.Changed:Connect(function()
for _,button in pairs(ScrollingFrame:GetChildren()) do
local search = string.lower(SearchBar.Text)
if button:IsA("ImageButton") then
if search ~= "" then
local flagName = string.lower(button.Name)
if string.find(flagName, search) and table.find(buttons,button.Name) then
button.Visible = true
else
button.Visible = false
end
else
if table.find(buttons,button.Name) then
button.Visible = true
end
end
end
end
end)