So basically I came across something that I really needed. It was, when no one is in a team the team is removed from the leader board and it gets put in a file in teams. Then when a player enters that team it re appears. Then that process should loop. After using that script I tried it in everything. A script in SSS, workspace, startergui in a local script, everywhere. but it never worked
So for the team removal
local Teams = game:GetService("Teams")
for _, team in pairs(game.Teams:GetDescendants()) do
if team:IsA("Team")then
team.PlayerRemoved:connect(function(player)
local players = team:GetPlayers()
if #players <= 0 then
team.Parent = game.Teams.NotInUse
end
end)
end
end
And for the Adding it back
local Team = "NameOfTeam"
local function GetTeamByNameInUnused(name)
if game.Teams.NotInUse:FindFirstChild(name) then return game.Teams.NotInUse[name] end
for _, team in pairs(game.Teams.NotInUse:GetChildren()) do
if team.Name:sub(1, name:len()):lower() == name:lower() then
return team
end
end
end
local team = GetTeamByNameInUnused(Team)
if team then
team.Parent = game.Teams
Player.Team = team
end
Thank you.
