A dynamic gui system

I want to make a system where someone can easily add more rows in a gui. For example, a script would be something like this

addRow('name', 'description', 'product id', 'price')

Where it’ll make a new row in the GUI with the information supplied, but I’m not sure how to do it

1 Like

You would create a local function


local function addRow(name, description, id, price)
-script here
end
1 Like

Of course I know how to define the function, I mean how do I make it work?

1 Like

You would have to use the basis of creating a GUI Element, such as a TextLabel, and then set all its properties.

local label = Instance.new("TextLabel")
label.Parent = script.Parent
-- and so on...
1 Like

Why not just use UIList or UIGrid? it’s a built in feature… And it works really well

2 Likes

Then all you do is clone a UI and it will automatically position itself correctly.

I might check it out as I didn’t know that a thing like that existed

Positioning was really the main problem that I had