local table1 = {}
for i = num, 1, -1 do
local Asset = MarketPlaceService:GetProductInfo(userTShirts[i])
local assetPrice = Asset.PriceInRobux
local assetId = Asset.AssetId
if assetPrice == nil or assetId == nil then
print("Failure")
else
-- Create a new table for each item with the price and id
local item = {price = assetPrice, id = assetId}
-- Insert the item into the table
table.insert(table1, item)
end
-- Create a new table for each item with the price and id
end
It would save, you are essentially grabbing the data and storing it elsewhere, while the data in Asset will just get garbage collected.
If the table is stored in the script you are using it, and no where else, and you remove it. It will get removed and then garbagecollected, but it it just stops running any code, it will stay there.
Thanks, I’m so confused then, thats the only thing I could think of as to why my gui is showing the same buttons every time it runs, when it should show different depending on the player.
If that is your entire Script then the table would still maintain the value that is set. If however it is inside a function like it is in your other question it will go out of scope and get deleted when the calling function returns.
Nothing is permanently saved unless you’re using a datastore to save and read it from.
You can clear the table by just restating it. Table = {} … or table = nil