I'm having issues with the y axis of my buttons. He's the code:
wait(1)
local tool = script.Parent
local frame = tool.Frame
local label = frame.Label
local list = frame.List
local createTool = frame.CreateTool
local createItem = frame.CreateItem
local processItem = frame.Process
local clear = frame.Clear
local ingTable = {}
function getDist(a, b)
return (a - b).magnitude
end
function checkIngTable(part)
for index, child in pairs(ingTable) do
if part == child then
return true
end
end
return false
end
function ing(index)
local ing = ingTable[index]
if ing ~= nil then
return ing.Name
else
return ""
end
end
function ingReal(index)
local ing = ingTable[index]
if ing ~= nil then
return ing
end
end
function saveIng(index)
local ing = ingReal(index)
if ing ~= nil then
table.remove(ingTable, index)
end
end
function setListName()
for index, child in pairs(ingTable) do
if index == 1 then
list.Text = child.Name
else
list.Text = list.Text..", "..child.Name
end
end
end
function alert(text)
delay(0, function()
for num = 1, 20 do
label.Text = text
wait()
end
end)
end
function clearTable()
ingTable = {}
list.Text = ""
end
function deleteTable()
for index, child in pairs(ingTable) do
child:remove()
end
clearTable()
end
function choices(choiceTab)
local buttons = tool.Parent.Parent.PlayerGui.ScreenGui:GetChildren()
for index, child in pairs(buttons) do
if child.Name == "ChoiceButton" then
child:remove()
end
end
local clicked = nil
local buttonText = ""
local buttonTab = {}
for index, child in pairs(choiceTab) do
local button = Instance.new("TextButton")
button.Position = UDim2.new(0.35, 0, index * 0.05 + 0)
button.Size = UDim2.new(0.1, 0, 0.05, 0)
button.BackgroundColor3 = Color3.new(0, 0, 0)
button.TextColor = BrickColor.new(1)
button.Name = "ChoiceButton"
button.Text = child
button.MouseButton1Down:connect(function() clicked = button print("Picked a choice") end)
button.Parent = tool.Parent.Parent.PlayerGui.ScreenGui
table.insert(buttonTab, button)
end
while clicked == nil do
wait()
print("Looped")
end
buttonText = clicked.Text
for index, child in pairs(buttonTab) do
child:remove()
end
return buttonText
end
I cannot seem to change the y axis of buttons by changing
button.Position = UDim2.new(0.35, 0, index * 0.05 + 0)
Help? Thanks!
