Hi! Recently i start a project and i work on team auto balance system i try make my own but it dosen’t work
it’s work for the first team “sun” but not for the “ocean” team then i try to delete the ocean to see if he can find the team but he succefuly delete the team then i don’t know where is my error
local TeamService = game:GetService("Teams")
local SunTeam = TeamService:WaitForChild("Sun")
local OceanTeam = TeamService:WaitForChild("Ocean")
local PlayerService = game:GetService("Players")
PlayerService.PlayerAdded:Connect(function(Player)
if #SunTeam:GetChildren() < 2 then
Player.TeamColor = BrickColor.new("Gold")
Player.Team = SunTeam
elseif #OceanTeam:GetChildren() < 2 then
Player.TeamColor = BrickColor.new("Cyan")
Player.Team = OceanTeam
end
wait(2)
end)