Would this table permanently save the info, or should it delete after the script has finished running

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

Thanks for any help :slight_smile:

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.

2 Likes

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.

1 Like

Its inside a function so it should get deleted. For some reason it always shows this on the gui, it never changes.


The numbers are always the same but it should change based on the users t shirts on sale.

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

1 Like