Hi, I am trying to achieve a custom chat logs list with a search gui. (already have chat logs working). Same with the command logs. I just need help with the search script, it isn’t working properly.
When I type things that are in the list, it doesn’t show them, but sometimes when I type things that aren’t in the list, it shows them.
Video of the issue:
Script for chat logs search:
local scroll = script.Parent.ScrollingFrame
local textBox = script.Parent.TextBox
textBox.Changed:Connect(function() changed
local text = textBox.Text:lower()
if text ~= "" then -- if it has text
local buttons = scroll:GetDescendants()
for _, button in pairs(buttons) do
if button:IsA("TextLabel") then
local buttonText = button.Text:lower() button text
if string.find(buttonText, text) then
button.Parent.Visible = true
else -- otherwise
button.Parent.Visible = false
end
end
--[[ if button:IsA("StringValue") and button.Name == "RuleText" then
local buttonText = button.Value:lower()
if string.find(buttonText, text) then
button.Parent.Visible = true
else
button.Parent.Visible = false
end
end]]
end
else -- if it's empty
local buttons = scroll:GetDescendants()
for _, button in pairs(buttons) do
if button:IsA("TextLabel") then
button.Parent.Visible = true
end
end
end
end)
Script for command logs:
local scroll = script.Parent.ScrollingFrame
local textBox = script.Parent.TextBox
textBox.Changed:Connect(function() changed
local text = textBox.Text:lower()
if text ~= "" then -- if it has text
local buttons = scroll:GetDescendants()
for _, button in pairs(buttons) do
if button:IsA("TextLabel") then
local buttonText = button.Text:lower() button text
if string.find(buttonText, text) then
button.Parent.Visible = true
else -- otherwise
button.Parent.Visible = false
end
end
--[[ if button:IsA("StringValue") and button.Name == "RuleText" then
local buttonText = button.Value:lower()
if string.find(buttonText, text) then
button.Parent.Visible = true
else
button.Parent.Visible = false
end
end]]
end
else -- if it's empty
local buttons = scroll:GetDescendants()
for _, button in pairs(buttons) do
if button:IsA("TextLabel") then
button.Parent.Visible = true
end
end
end
end)
This is what it looks like not playing the game.
And this is what it looks like playing the game.
There are no errors in the output.
Any help is appreciated.