So I am trying to make a item finder sort of plugin and I am trying to make it so if you search for an object if it has the same name or a abbreviation of the name it searches for the amount of items that has the same name as the item that I am looking for but the problem is it only select one item then it goes to the next item and that’s it but here’s a video of the problem I am having
– It only selects one of the triangles for the search then goes on to the next one for the next item blue selected is mine and brown selected is person trying to help me
Script:
local toolbar = plugin:CreateToolbar("Item Finder")
local ItemFinderButton = toolbar:CreateButton("Find Items", "Search For the Item you want with ease", "rbxassetid://1490704267", "Item Finder")
local Opened = false
local Selection = game:GetService("Selection")
local ItemFinderWidgetInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Left,
false,
false,
200,
300,
150,
150
)
local FinderWidget = plugin:CreateDockWidgetPluginGui("Item Finder", ItemFinderWidgetInfo)
FinderWidget.Title = "Item Finder"
local ItemFinderGui = script.Parent.ItemFinderGui
ItemFinderGui.Parent = FinderWidget
local GUIName = ItemFinderGui.NameSearcher
local SearchButton = ItemFinderGui.SearchButton
SearchButton.MouseButton1Click:Connect(function()
local selectedObjects = Selection:Get()
local parent = game.Workspace
local search = string.lower(GUIName.Text)
for i, object in pairs(workspace:GetDescendants()) do
local part = object:IsA("Part")
local Model = object:IsA("Model")
local Script = object:IsA("Script")
local Accessory = object:IsA("Accessory")
local Folder = object:IsA("Folder")
local LocalScript = object:IsA("LocalScript")
local meshpart = object:IsA("MeshPart")
local tool = object:IsA("Tool")
if part then
else
if Model then
else
if Script then
else
if Accessory then
else
if Folder then
else
if LocalScript then
else
if meshpart then
else
if tool then
end
end
end
end
end
end
end
if search ~= "" then
local item = string.lower(object.Name)
print("Finding Item")
if string.find(item, search)then
print("Item Found!")
wait(1)
Selection:Set({object})
print("Selected")
else
if string.find(item, search) then
print("Item is not found!")
end
end
end
end
end
end)
ItemFinderButton.Click:Connect(function()
if Opened then
FinderWidget.Enabled = false
Opened = false
else
FinderWidget.Enabled = true
Opened = true
end
end)