Hello guys im making a game like google that can search anything I putted but
I don’t know how I’m just new at scripting and I tried to find on yt or other but I have this script maybe is good?
local scroll = script.Parent.Parent.ScrollingFrame -- CHANGE THIS TO YOUR SCROLLING FRAME
local textBox = script.Parent -- CHANGE THIS TO YOUR TEXT BOX
textBox.Changed:Connect(function() -- when the text is changed
local text = textBox.Text:lower() -- lowercase search bar text
if text ~= "" then -- if it has text
local buttons = scroll:GetDescendants() -- all of the buttons
for _, button in pairs(buttons) do -- loops through the buttons
if button:IsA("TextButton") then -- if it's a button
local buttonText = button.Text:lower() -- lowercase button text
if string.find(buttonText, text) then -- if search bar text is found in the button's text
button.Visible = true -- shows button
else -- otherwise
button.Visible = false -- hides button
end
end
end
else -- if it's empty
local buttons = scroll:GetDescendants() -- all buttons
for _, button in pairs(buttons) do -- loops through buttons
if button:IsA("TextButton") then -- if it's a button
button.Visible = true -- shows button
end
end
end
end)
if you’re a new scripter then this is a horrible thign to start out with tbh. its extremely complicated, and it may not even bhe possible without inputing everysingle possible series of character that can be searched
im confused i tried to see how but i don’t know how I can delete the button
textBox.SH.MouseButton1Click:Connect(function() -- when the text is changed
local text = textBox.Text:lower() -- lowercase search bar text
if text ~= "" then -- if it has text
local buttons = scroll:GetDescendants() -- all of the buttons
for _, button in pairs(buttons) do -- loops through the buttons
if button:IsA("TextButton") then -- if it's a button
local buttonText = button.Text:lower() -- lowercase button text
if string.find(buttonText, text) then -- if search bar text is found in the button's text
script.AdminGUI:Clone() -- does it
button.Parent = Players:WaitForChild("PlayerGui")
else -- otherwise
-- hides button
end
end
end
else -- if it's empty
local buttons = scroll:GetDescendants() -- all buttons
for _, button in pairs(buttons) do -- loops through buttons
if button:IsA("TextButton") then -- if it's a button
button.Visible = true -- shows button
end
end
end
end)
well i have a issue if i dont use the button local the search engine might not work
well the thing didn’t show
local scroll = script.Parent.Parent.ScrollingFrame -- CHANGE THIS TO YOUR SCROLLING FRAME
local textBox = script.Parent -- CHANGE THIS TO YOUR TEXT BOX
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
textBox.SH.MouseButton1Click:Connect(function() -- when the text is changed
local text = textBox.Text:lower() -- lowercase search bar text
if text ~= "" then -- if it has text
local buttons = scroll:GetDescendants() -- all of the buttons
for _, button in pairs(buttons) do -- loops through the buttons
if button:IsA("TextButton") then -- if it's a button
local buttonText = button.Text:lower() -- lowercase button text
if string.find(buttonText, text) then -- if search bar text is found in the button's text
local GUI = ReplicatedStorage.Websites:Clone()
GUI.Parent = PlayerGui:WaitForChild("PlayerGui")
else -- otherwise
local GUI = ReplicatedStorage.Websites.robloxcom:Destroy()
GUI.Parent = PlayerGui:WaitForChild("PlayerGui")-- hides button
end
end
end
else -- if it's empty
local buttons = scroll:GetDescendants() -- all buttons
for _, button in pairs(buttons) do -- loops through buttons
if button:IsA("TextButton") then -- if it's a button
local sus = ReplicatedStorage.Websites.robloxcom:Clone()
sus.Parent = PlayerGui:WaitForChild("PlayerGui")
end
end
end
end
now what i did it what next what sould I now do coz it still ain’t working
local scroll = script.Parent.Parent.ScrollingFrame -- CHANGE THIS TO YOUR SCROLLING FRAME
local textBox = script.Parent -- CHANGE THIS TO YOUR TEXT BOX
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
textBox.SH.MouseButton1Click:Connect(function() -- when the text is changed
local text = textBox.Text:lower() -- lowercase search bar text
if text ~= "" then -- if it has text
local buttons = scroll:GetDescendants() -- all of the buttons
for _, button in pairs(buttons) do -- loops through the buttons
if button:IsA("TextButton") then -- if it's a button
local buttonText = button.Text:lower() -- lowercase button text
if string.find(buttonText, text) then -- if search bar text is found in the button's text
local GUI = ReplicatedStorage.Websites:Clone()
GUI.Parent = PlayerGui:WaitForChild("PlayerGui")
else -- otherwise
local GUI = ReplicatedStorage.Websites:FindFirstChild(buttonText)
if (not GUI) then
print('get 404 page')
return
end
GUI.Parent = PlayerGui
end
end
end
else -- if it's empty
local buttons = scroll:GetDescendants() -- all buttons
for _, button in pairs(buttons) do -- loops through buttons
if button:IsA("TextButton") then -- if it's a button
local sus = ReplicatedStorage.Websites.robloxcom:Clone()
sus.Parent = PlayerGui:WaitForChild("PlayerGui")
end
end
end
end)