What do you want to achieve?
Merge items in a table to show TestItemx2 instead of TestItem,TestItem
What is the issue?
i have no clue how to do this
local ItemsList = {}
for _,item in pairs(workspace:GetPartsInPart(game.Workspace.Shops.MainShop.CounterBox)) do
if item.Parent.Parent == game.Workspace.Objects.ShopItems then
table.insert(ItemsList,item.Parent.Name)
end
end
local TextTable = {}
local text = nil
for _,item in pairs(ItemsList) do
if text == nil then
text = item
else
text = text..","..item
end
end
game.Workspace.Shops.MainShop.CounterBox.SelectionBox.Visible = true
plr.PlayerGui.ShopGui.MainShop.Text.Text = "Would You Like To Buy "..text.." For ".."?".. "?"
plr.PlayerGui.ShopGui.MainShop.Visible = true
local Tab = {"A","A","A","B"}
local function GetUniqueEntries(Tab)
local Unique_Table = {}
for i = 1, #Tab do
Unique_Table[Tab[i]] = (Unique_Table[Tab[i]] or 0) + 1
end
return Unique_Table
end
local UniqueCounts = GetUniqueEntries(Tab)
for Name,Count in pairs(UniqueCounts) do
print(Name.."X"..Count)
end