Hello,
I am trying to Insert a Table (subs
) to another Table (results
)
My Issue is that I am getting duplicates of the values after I inserted the table.
I haven’t seen any solution on Devforum so I decided to make a post.
Script
local function findStringInTable(tables,str)
local results = {}
local subs = {}
for _,tab in pairs(tables) do
for i,value in pairs(tab.SubTagsFolder:GetChildren()) do
if (string.match(value.Name,str)or string.match(value.Value,str)or string.match(tab.Name,str)or string.match(tab.Value,str)) and (not table.find(results[1],tab.Name)) then
table.insert(results,{tab.Name})
table.insert(sub,1,value.Name)
for index, value2 in pairs(tab.SubTagsFolder:GetChildren())do
if (not table.find(subs, value2.Name))then
table.insert(subs,#subs + 1,value2.Name)
print(unpack(subs)) --// first print
end
end
table.insert(results[1], subs) --// here is where I inserted the table
end
end
end
return results
end
local results = findStringInTable(TagsDataFolder:GetChildren(),query)
print(unpack(results[1][2])) --// second print
print(id)
game.ReplicatedStorage.Slide1.SearchEvent:FireClient(plr,id, results)
Output
Any help would be Useful