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

What Is The Right Code For My Local Script At Line 2?

Asked by 2 years ago
Edited 2 years ago

I'm trying to make a Search Bar for an Inventory system but I realized the area where the script will search is complicated, I'm trying to find the right child or code for it. While the game runs or is being played there will be a duplicate of "ImageButtons" at least that I was expected, but when I look at the explorer tab while the game is running, I was expecting to find the children of the Scrolling frame but it is still the same as before didn't change. I did not create this script just found it on youtube and found the free model on its description, also the search script was found on Roblox studio tools, A free model. The first screenshot is the game while playing. The second screenshot is the game while NOT playing, I know they're the same in your eyes but they're different trust me which is why I'm stuck to find the child of it or the right code for it and I need help to find it. The red box shows the area should be the search area.

Edit: I found out that the links are not working so just copy-paste the link :/

ScreenShots of the problem link: (it is in a google drive) https://drive.google.com/drive/folders/1yPQcBDSgL1lv8EpjYUSHJcA4LxYpgFGH?usp=sharing

Youtube link: https://www.youtube.com/watch?v=qfc8lNxrhc8&t=20s

Youtube free model link: (I was trying to add a search bar for this model) https://www.roblox.com/library/6946265038/Custom-ToolBar-inventory

Please Remember the following:

The TextBox is the search bar where the player searches the Image Button.

-In the script at line 2, I still don't know the right area/Children to be coded.

-The area of which the Localscript is at the scrolling frame's children or the scrolling frame itself. I don't know really I need help

**-The reason why I called "Child" the lower part of the scrolling frame was because of a script code ":WaitforChild()." * I'm still a starter scripter ohkeh ;-;***

There is a LocalScript, named just "LocalScript" inside of it, is this:

local searchBar = script.Parent.Inventory.TextBox 
local items = script.Parent.Inventory.ImageLabel.ScrollingFrame.Template

function UpdateResults()
    local search = string.lower(searchBar.Text)
    for i, v in  pairs(items:GetChildren()) do
        if v:IsA("ImageButton") then
            if search ~= "" then
                local item = string.lower(v.Text)
                if string.find(item, search) then
                    v.Visible = true
                else
                    v.Visible = false
                end
            else
                v.Visible = true
            end
        end
    end
end

searchBar.Changed:Connect(UpdateResults)

1 answer

Log in to vote
0
Answered by 2 years ago

I found out that the links aren't working so just copy-paste them :/

Ad

Answer this question