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

Any help with a Search GUI? [Unanswered]

I was experimenting with Search GUI's and came up with this, now I was wondering if someone can tell me what I am doing wrong with it as to why it's only working if I type the full text? I want it to be visible if I type stuff like C and there's a frame named Cow.

Here's what I tried:

local frame = script.Parent.Parent.ScrollingFrame

script.Parent.Changed:connect(function()
	for _,v in pairs(frame:GetChildren()) do
		if string.find(script.Parent.Text,v.Name) then
			v.Visible = true
		else
			v.Visible = false
		end
	end
end)

How would I make it work if I typed stuff like "C"?

Any help appreciated.

Sorry I can't explain any better.

1 answer

This works if there is everything in one parent:

local text = "c"
text = text:lower() -- to avoid stuff ups
local children = script.Parent.Frame:GetChildren()

function check()
	for _,v in pairs (children) do
		local s = text:len()
		local find = v.Name:sub(1,s)
		find = find:lower()
		if find == text then
			return v
		end
	end
end

check()

SORRY, ANOTHER ERROR I MADE I have fixed it :/ local s = text:len(), not v.Name:len(). It works now. Hope I helped :)

5 comments

0

calling 'len' on bad self (string expected, got table) 22:34:29.702 -

0

Sorry about that, was a small error. Try it now.

0

Still doesn't work. :/

0

it works. I tested it myself. Copy this into a scripr inside a screenGui. also inside the screengui should be a frame called Frame with a Frame inside it called Cow

0

It set's it's visible to false, even if I type "C" or "c". :/

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