I’m making a team change GUI, and once you click it, it changes your team, respawns you, then makes the GUI invis.
Code:
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local items = script.Parent:GetChildren()
for i,v in pairs(items) do
if v:IsA("TextButton") then
table.insert(newTable,v)
end
end
for i,v in pairs(newTable) do
v.MouseButton1Click:Connect(function()
script.Parent.splat:Play()
local plr = script.Parent.Parent.Parent.Parent
print(plr.Name)
local team = game.Teams:FindFirstChild(v.Text)
plr.TeamColor = team.TeamColor
plr:LoadCharacter()
wait(7)
plr.PlayerGui.MainMenu.Enabled = false
end)
end```