Sorry to be back so soon, but I have a question. I have this function below that activates when any of the buttons in a table is pressed. My issue is, how would I know which button the player pressed while keeping this format? I know I can make a function that activates when a specific button is pressed instead of one inside the table but i can keep my code shorter by detecting input from any of them then having the script know which one was pressed anyway so I don’t have to copy-paste functions.
Any help is appreciated, thanks.
v.Button.MouseButton1Down:Connect(function()
if confirmation == false then
confirmation = true
for i, w in pairs(Classes) do
if w["Button"] then
if v ~= w then
w.Button.Visible = false
script.Parent.SelectedClass.Value = w["ID"]
script.Parent.Yes.Visible = true
script.Parent.No.Visible = true
end
script.Parent.TopText.ClassDesc.Text = "You have chosen to go with "..w["Name"]..". Are you sure? This can be changed later."
SClassCheck.Value = w["ID"]
print(w["Name"]..w["ID"])
end
end
end
end)