Script wont assign player team to new team

Im trying to assign each player to the “Playing” team when a round starts. The team gets created but the player doesn’t get assigned to the team. The new team also does not appear in the leaderboard.

Heres the section of the script thats handling the Teams

local playingTeam = Instance.new("Team")
	playingTeam.Name = "Playing"
	playingTeam.Parent = teamsService
	print("New team created")
	print(playingTeam)
	
	for _,plr: Player in pairs(Players:GetChildren()) do
		if not plr.Character then continue end
		if not plr.Character.PrimaryPart then continue end
		
		print("Player Team")
		print(plr.Team)
		plr.Team = playingTeam
		print(plr.Team)

Do you have a line like this at the top somewhere?

local teamsService = game:GetService("Teams")

Make sure it’s spelled correctly (note the ‘teams’ plural in the name).

1 Like

Yeah, teamService is declared as so;

local teamsService = game:GetService("Teams")

Hmm. Shouldn’t matter that team colors aren’t assigned (although if it is sharing a color with Lobby then maybe). Maybe try assignment like this:

plr.Team = teamsService.playingTeam
1 Like

Do the teams have the same TeamColor? If so, try making it so they do not have the same TeamColor.

2 Likes

I guess assigning team colors do matter lol, this fixed the issue. Thank you!

1 Like