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 = Instance.new('TextLabel')
			newButton.BackgroundColor3 = Color3.new(0.564706, 0.564706, 0.564706)
			newButton.Parent = newFrame
			newButton.Position = UDim2.new(0.279, 0, posValue + 0.243, 0)  --posValue is 0.115
			newButton.Size = UDim2.new(0.534, 0,0.141, 0)
			newButton.Text = tostring(z)
			newButton.TextScaled = true
			newButton.TextColor3 = Color3.new(1, 1, 1)
					
			
				end
				break
				
			end

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