You are looping through the item, i is the current key, and x is the current value you don’t have to loop through it and all you have to do is item.UniqueID.
This is a script for my gui, I may not have proposed this correctly:
I have a buttons table and I add a new button in it and the item info (which is v)
local itemFrame = script.ItemPreview:Clone()
itemFrame.ItemName.Text = v.Name
itemFrame.Parent = x
local buttonTable = {
[1] = itemFrame,
[2] = v,
}
table.insert(buttons,buttonTable)
And then I loop through the buttons table:
for _,v in pairs(buttons) do
for i,x in pairs(v[2]) do
--print(x)
print(i.UniqueID)
end