How Can I Create A Search System In Game?

So my goal is to make a search system made out of guis in Roblox. A Textbox for the search part and a scrolling frame for the items.

The issue is I do not know if Roblox is this advanced yet for my knowledge, so I don’t know where to find it or if it’s even possible.

I had a couple of solutions but I don’t know how to explain them they are not important anyway.

Here are the UI and stuff so you can picture it better:

10 Likes

It’s definitely possible to do this. I’m not sure why you wouldn’t think it’s able to. Can you explain what problems specifically you’re running into?

2 Likes
  1. I dont really know how to do this (I know how to code I just dont know what to use)

  2. I searched all over YouTube and the DevForum and nothing that was what I needed

1 Like

Yesterday i just searched for the same thing, i got 2 useful results:

You might want to search threads before posting, i hope this helps :slight_smile:

3 Likes

wait is this only for usernames I need it for a UI Grid layout ui thing

2 Likes

If i remember, those scripts in those threads returns a table with the results, you might want to Disable the frames that are not in the table. Well, remember to also try to fix your issues too :slight_smile:.

1 Like

…I do not get a single thing ima just find a way myself that is not complicating…

1 Like

This video has everything but not complicating and what i need: https://www.youtube.com/watch?v=9QIJhla2WLc

1 Like

I used this for my own game

local Frame: ScrollingFrame = nil -- Put the parent of the buttons here instead of nil
local SearchBar: TextBox = nil -- Put the textbox of your searchbar here instead of nil
SearchBar:GetPropertyChangedSignal("Text"):Connect(function()
	local InputText: string = string.lower(SearchBar.Text)
	for _, Button: Instance in pairs(Frame:GetChildren()) do
		if Button:IsA("TextButton") or Button:IsA("ImageButton") then
			Button.Visible = string.find(string.lower(Button.Name), InputText) and true or false
		end
	end
end)

It probably works, and it’s not case sensitive

Late edit:
(I did some code cleanup)

Each time the text of SearchBar changes, it will iterate through the children of Frame:

  • It checks for each child if they are a TextButton or an ImageButton class.
  • It then sets the Visible property of the children of which a part of the name matches with the input to true, or else it will set it to false.

(Make sure to use a UIListLayout or UIGridLayout in the ScrollingFrame or else you might get unwanted behaviour such as empty spaces if they are on set positions and have nothing else that orders their new positions.)

24 Likes

It is possible and I might say trivial to do.
Just for the text to be changed, delete everything in the scrolling frame and do a for lopp comparison on the data set.

It Seems Weird That A Thing Such As This Does Not Get Much Attention And Ima Test It Out!

IT WORKS! I did not even think it would work but it works exactly how i need it! Thanks!

2 Likes