Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Command Search Script Doesn't put all the commands back after the search is nil or == ""?

Asked by
LuaDLL 253 Moderation Voter
4 years ago
Edited 4 years ago

Script:

wait(5)

local Search = script.Parent
local Cmds = script.Parent.Parent.Cmds

local InResearves = {

}

Search:GetPropertyChangedSignal("Text"):Connect(function()

    if Search.Text == "Search" or Search.Text == "" or Search.Text == nil or #Search.Text == 0 then
        print("Search")
        for i,v in pairs(InResearves) do
            v.Parent = Cmds
            table.remove(InResearves,i)
        end
    else
        print(Search.Text)
        for i,v in pairs(Cmds:GetChildren()) do
            if v:IsA("TextLabel") then
                if string.sub(v.Name,0,#Search.Text) ~= Search.Text then
                    print(v.Name.." ~= "..Search.Text)
                    table.insert(InResearves,v:Clone())
                    v:Destroy()
                else
                    print(v.Name.." == "..Search.Text)
                end
            end
        end
    end
end)

it doesn't put all the commands back into the gui when the text of Search is nothing

0
Remove the call to wait a line 1, now. You don't need it at all. User#24403 69 — 4y

Answer this question