Im trying to make a script that disables another Search bar script that just looks for the ImageButtons, but i want another one to look for a String Value’s name and value. And i want the script to activate when you press a button, and disable another script
local SearchBar = script.Parent.Parent.TextBox
local x = false
function SearchBarFunction()
local InputText=string.upper(SearchBar.Text)
for _,v in pairs(script.Parent.Parent.Parent.Easy.Davez:GetChildren())do
if v:IsA("ImageButton")then
for c,j in pairs(script.Parent.Parent.Parent.Easy.Davez:GetChildren())do
if j:IsA("StringValue") and j.Name == "Realm" then
if InputText==""or string.find(string.upper(j.Value),InputText)~=nil then
v.Visible=true
else
v.Visible=false
end
end
end
end
end
end
local function baby()
script.Parent.Search.Enabled = false
script.Sound:Play()
SearchBar.Changed:Connect(SearchBarFunction)
end
script.Parent.Parent.World.MouseButton1Click:Connect(baby)
Script connections can overlap, SearchBar will add a new connection each time the function baby is called. Since you never disconnect it it will keep on adding connections and piling up memory slowly. Your connected function SearchBarFunction shouldn’t act differently but will lag more as the connections pile up.
It’s really hard to tell what you want to happen with this script. You can disable other scripts with the Disabled property
I’ve probably fixed the memory leak by making a seperate script inside the button, But the Textbox still doesn’t look for the value inside the stringvalue’s value.
local SearchBar = script.Parent.Parent.TextBox
function SearchBarFunction()
local InputText=string.upper(SearchBar.Text)
for _,v in pairs(script.Parent.Parent.Parent.Easy.Davez:GetChildren())do
if v:IsA("ImageButton")then
for c,j in pairs(script.Parent.Parent.Parent.Easy.Davez:GetChildren())do
if j:IsA("StringValue") and j.Name == "Realm" then
if InputText==""or string.find(string.upper(j.Value),InputText)~=nil then
v.Visible=true
else
v.Visible=false
end
end
end
end
end
end
SearchBar.Changed:Connect(SearchBarFunction)
Basically whenever the user types for example “H” on the textbox
There are two values in here:
Hub
and W1: Wilderness
It looks for everything that starts with, or Has “H”, Only hub shows up. So it makes the Child of the Stringvalue that houses “H” Visible.
Also for the other question I just modified another script that just works the same way but for the names of the ImageButton
Don’t you want to search the children of the ImageButton? Is that where the StringValue “Realm” is located? I’m sorry I still don’t understand the structure, “Child of the StringValue that houses “H” Visible” is mixing me up.
for _,v in pairs(script.Parent.Parent.Parent.Easy.Davez:GetChildren())do
if v:IsA("ImageButton")then
for c,j in pairs(v:GetChildren())do