I have tried to make a search system where the users search for an item. This works, but only goes to one TextLabel (“Numbah3”). Here’s the Local Script:
local textBox = script.Parent
textBox.FocusLost:Connect(function(enter)
if enter then
for _,v in pairs(textBox.Parent:GetChildren()) do
if v:IsA("TextLabel") then
local text = v.Text
local substringed = string.sub(v.Text,1,#textBox.Text)
local function search()
while wait() do
if substringed == string.sub(v.Text,1,#textBox.Text) then
for _,t in pairs(textBox.Parent:GetChildren()) do
if t:IsA("TextLabel") then
t.Transparency = 1
end
end
v.Transparency = 0
end
end
end
search()
end
end
end
end)
I don’t really know how to script these types of stuff well so help is appreciated.
You have an unyielding loop in your code, which means it gets stuck doing the same thing. If you completely remove the while wait() do thing, does it work correctly?