Character Assign Script Always Assigns Red Team's Character

I am making a fighting / zone wars game that combines classic roblox and modern roblox (Sword skills and R6) and this script is a bit annoying so I thought I’d ask for help here, as I said only the red teams character is being assingned.

here’s the code:

local rs = game:GetService("ReplicatedStorage")
local chars = rs.Characters
local redchar = chars.StarterCharacter2
local bluechar = chars.StarterCharacter1

local starterplr = game:GetService("StarterPlayer")

local respawn_time = 5

game.Players.PlayerAdded:Connect(function(plr)
	task.wait(1)
	if plr.Team == game.Teams["Red Ravagers"] then
		local starterchar = redchar:Clone()
		starterchar.Name = "StarterCharacter"
		starterchar.Parent = starterplr
		plr:LoadCharacter()		
	end
	
	if plr.Team == game.Teams["Dark Blue Destroyers"] then
		local starterchar = bluechar:Clone()
		starterchar.Name = "StarterCharacter"
		starterchar.Parent = starterplr
		plr:LoadCharacter()
	end
	
	local char = plr.Character
	local hum = char:WaitForChild("Humanoid")
	
	hum.Died:Connect(function()
		task.wait(respawn_time)
		plr:LoadCharacter()
	end)
end)

Try using game.Teams:WaitForChild(TeamName)

2 Likes

Try TeamColor instead of Team instance

1 Like

Double check the properties of the teams. In particular AutoAssignable. You’d want both teams to have this property set to True.

1 Like