-
What do you want to achieve? Once a player loads in the game and clicks a button, I would like to create buttons with the text specific to the names in the table so that I don’t have to input them manually every time.
-
What is the issue? Items don’t clone and the local script runs twice.
-
What solutions have you tried so far? Here is my code:
local namesTable = {
"Mario",
"Deshawn",
"Dude",
"Max"
}
local sampleButton = script.Parent.FirstNamesFrame.Sample
local currentPosition = 0
local function createNamesButtons()
for index, name in pairs(namesTable) do
currentPosition = 0 + 0.065
local clone = sampleButton:Clone()
clone.Position = UDim2.new(0.5, 0, currentPosition, 0)
clone.Parent = sampleButton.Parent
clone.Text = name
print(name)
end
print('Finished function')
end
createNamesButtons()
I know that storing the position in a local variable is bad practice and not efficient at all but I don’t seem to find any other way to do it.
