How to create a # of an instance and change position each time

I have a table that returns a random # of values, lets say one time it returns a, b, c and another it returns a, b, c, d, e, f

How would I make an amount of text labels for the amount of values and change each text labels text to the value provided?

This is my code so far:

for _, z in pairs(table) do
					local newButton ='TextLabel')
			newButton.BackgroundColor3 =, 0.564706, 0.564706)
			newButton.Parent = newFrame
			newButton.Position =, 0, posValue + 0.243, 0)  --posValue is 0.115
			newButton.Size =, 0,0.141, 0)
			newButton.Text = tostring(z)
			newButton.TextScaled = true
			newButton.TextColor3 =, 1, 1)

However it’s not working and only creating one text label. Any help appreciated, thanks!

Can you provide the snippet of where your Table is being created or where it’s being changed.

1 Like

It’s only creating one TextLabel because you used break at the end of your for loop. The break tells the script to cease the loop at its current point and no longer run the remaining iterations (if any). Therefore, your loop only runs once. Remove the break and get back to me with results.

1 Like

@Volieb @Velliaan I was nesting another for loop that I forgot to comment out and it was causing this problem. Nonetheless, thanks