it doesn't seem to delete the team... Serverscript in ServerScriptService:
game.ReplicatedStorage.Teams.Teamen.OnServerEvent:Connect(function(player, team) local realteam = game.Teams:FindFirstChild(team) if game.Teams:FindFirstChild(team) then player.TeamColor = realteam.TeamColor player:LoadCharacter() else local clone = game.ReplicatedStorage.TTeams:FindFirstChild(team):Clone() clone.Parent = game.Teams wait(0.1) player.TeamColor = game.Teams:WaitForChild(team).TeamColor player:LoadCharacter() clone.Kill.Disabled = false end end)
This is a script in the Team that needs to be deleted if there is no anyone on it:
script.Parent.PlayerRemoved:Connect(function() local team = script.Parent wait() if #team:GetPlayers() == 0 then script.Parent:Destroy() end end)