here is the script i am working with
local teamService = game:GetService("Teams")
local teamsTabel = {
"Mailman",
"Chef",
"GameDev",
"Jobless",
"Child",
"Store Clerk"
}
for i, v in pairs(teamsTabel) do
local newTeam = Instance.new("Team")
newTeam.TeamColor = BrickColor.new(i + 20)
newTeam.Name = v
newTeam.Parent = game.Teams
local newButton = game.ReplicatedStorage.Frame:Clone()
newButton.TextButton.Text = v
newButton.Parent = game.StarterGui.ScreenGui.Frame
end
as you can see i create a button for every job in my table, how would i go about making it so that whenever i pressed the button that was created, it can do something related to the button (eg. put me on a team same as it's index)

1 comment
You can connect the button you make inside the loop as well