Did I approach this issue good?

local mainFrame = script.Parent.Ui:WaitForChild("MainFrame")

local unitFrame = mainFrame.UnitFrame
local unitCategoryFrame = mainFrame.UnitCategoryFrame

local moduleFolder = game.ReplicatedStorage.Modules
local unitInfo = require(moduleFolder.UnitInfo)

for categoryKey, categoryData in pairs(unitInfo) do
	local createCategoryButtons = unitCategoryFrame.PlaceholderCategory:Clone()
	createCategoryButtons.Parent = unitCategoryFrame
	createCategoryButtons.Name = categoryKey
	createCategoryButtons.Image = categoryData.CategoryPicture


So I have a template button which will get cloned for how many categories there are in my module etc… etc…

Tho at the end I have to delete the template and keep the cloned ones that I can use.

Is this a good way to do it or is there a better fix?

1 Like