Hey guys, i'm trying to make a script that creates and centers x amount of guis for x amount of "items" The current code displays and creates the 3 guis, but i'm unsure how to go about centering them.
Thanks for looking and i hope someone can help
EDIT:
Due to many people being unable to help me because of my lack of explanation here is some more details about what i'm trying to do.
I have a long frame and i want to fit in #items amount of smaller frames in it which are equally spread out filling the longer frame
Thanks again
local items = {
"item1", "item2", "item3",
}
local gui = script.Parent
for i = 1, #items do
print(i)
local slot = Instance.new('TextButton',gui.Frame)
slot.Name = items[i]
slot.Text = items[i]
slot.Size = UDim2.new(0.15,0,1,0)
slot.Position = UDim2.new((0.16*i)-0.16,0,0,0) --How do i fix this line?
end

2 comments
What do you mean by centre? How do you want to lay them out?
Just use my centerX function on every gui