Procedurally Generating UI Elements via scripting

Hello, I am attempting to fill my shop UI frame with item previews via procedural generation (By grabbing model names from a shop folder). My idea was to have a UIGridLayout constraint within that frame that would automatically format the new previews as a grid.

for _,item in ipairs(ItemTable) do
    local newItemPreview = ItemPreview:Clone()
    newItemPreview.Parent = ItemPreview.Parent

My issue is that when the script runs, I can see in the explorer that the previews do in fact clone, however they appear invisible.

Have you checked that ItemPreview's property Visible is set to true?

1 Like

I normally parent my ui’s into the UiGridLayout to hide them. Then I would parent them into the frame so that it auto formats.


They are all set to true.

Here is what happens when the script runs:


I am currently parenting them directly into the frame. Do you think it would work if I first parented them into the UiGridLayout, then parented them into the frame?