Cant dynamically set GUI button text

Title says it all, I’m trying to dynamically set text button text but I cant seem to get it to work properly. To keep things short and simple, all you need to know is that there are two items in a table. one is buildables_table1 and the other is buildables_table2

I can get it to print the first entry, but not the second entry. Here is my code, i’ll explain it underneath.

local localBuildableFrames = game.Players.LocalPlayer.PlayerGui.Backpack.BackpackUI.Frame:GetChildren()
	for o, name in pairs(itemCategories['Buildables']) do
		local frame = localBuildableFrames[o] 
		if frame:IsA("TextButton") then
			frame.Text = name

Its pretty simple, localBuildFrames are the frames (obviously) Then i go over the item table (what holds the two buildables). I’m printing the index and the name just to double check the exist. RobloxStudioBeta_31qvIZZiIj

after that, i’m getting the frame’s index, im checking if its a textbutton, and if it is its going to set the text of the frame, to the name of the item.

This works, however it only works with one item and im not sure why.

Your Indexes are messed up. You are referencing the index o of localBuildableFrames[o] with the index value from pairs(itemCategories['Buildables']). Pick one or the other, not both.
Please show the structure of the UI as there will be a cleaner way to do this.