Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make a search box without it needing the entire name?

How do you make a search box that can look through a table without needing the whole name? Eg. if you type "alpha" it would show everything that starts with "alpha" like "Alpha" and "Alphabet" depending on whatevers in the table. Thanks

Note, I'm not looking for someone to write the script - even a wiki link would be handy as all I've found was people talking about web features. Thanks

1 answer

✓ Accepted answer

String.match is great in situations like this.

words = {"Test1","Test3","sdfdsf","sdtgr"}

for i,v in pairs(words) do
	local checkMatch = string.match(v,"sd")

	if checkMatch then
		print(v.." matches with sd!")
	else
		print(v.." doesn't match with sd!")
	end
end

In the code above we have a table containing four strings. Once we declare the table we loop through it and check if the item in the table we're checking currently has "sd" in it. If that's the case we print that it does match with sd. If not, we print it doesn't match with it.

This discussion is preserved as it was. New answers, comments, and votes are closed.