Your code is an improvement over OP, but @S0MBRX’s code shortens it even more.
Your code would be:
local frame = DialogGui.Frame.Frame
local button1 = frame["1"]
local button2 = frame["2"]
local button3 = frame["3"]
--Test (this one doesn't need brackets):
print(Buttons1.Name)
Whereas their code is much shorter:
local Frame = DialogueGui.Frame.Frame
local Buttons = {Frame["1"],Frame["2"],Frame["3"]}
--Test (you just add [] around the number this time)
print(Buttons[1].Name)
They both function the same, it’s just his is more clean, if you will.