Is there a way to put the items in a table onto gui buttons without having to change each button?

Right now I’m working on a game where it basically has different level of items. Basically Im wondering if I could stick those into a table with a number the would correspond to the gui button.

Any help is appreciated

Can you elaborate? Can’t help much with such a specific yet undetailed question

So if I take a table with items in it right? If i wanted to put those into a gui like a shop where it displays there price. how would I do that without having to change the text of every single Gui?

Well you would have to change some text for it to work.

-- THis is an example
local items = {
   Cheese = true
}

for Name, Value in items do
    local UIItem = TextButton:Clone() -- Pretend this is a text button
    UIItem.Text = Name
    UIItem.Parent = WhateverYouWantThisButtonIn 
end

What this would do is loop through all items in a table, and then create a text button for it, it then sets the text of the textbutton to match the name of the item, in this case we end up with a textbutton thats text is “Cheese”

Thank you It’s kind of what I’m looking for but now I got a base to work off of. Thanks!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.