Why my script assigning players to the wrong team?

Hey, i want to make a hide and seek game where a random player gets picked and is the seeker.
but i made it so everytime a player joins they instantly get assigned to a spectator team, and then has to wait a round to play, but when a player joins, they instantly get assigned to the seeker team, how do i prevent that?

game.Players.PlayerAdded:Connect(function(plr)
	plr = game.Teams.Spectator
end)

local recol = 0


game.Players.PlayerAdded:Connect(function(amount)
	recol = recol + 1
	print("Added 1")
end)

game.Players.PlayerRemoving:Connect(function(amount)
	recol = recol - 1
	print("Lost one player!")
end)

if recol <= 2 then
	print("Sorry but the game has less than 2 players!")
	return nil
end

if recol >= 2 then 
	wait(20)
	
	local playerCharacters = {}

	for _, character in pairs(workspace:GetChildren()) do
		if game.Players:FindFirstChild(character.Name) then
			table.insert(playerCharacters, character)
		end
	end

	local Seeker = playerCharacters[math.random(1, #playerCharacters)]
	print(Seeker)

	Seeker.HumanoidRootPart.Position = Vector3.new(130.046, 5.5, 0.84)
	Seeker = game.Teams.Seeker

	if playerCharacters == game.Teams.Seeker then
		return nil
	else
		playerCharacters = game.Teams.Hiders
	end
end


if you can help please do:D

Here in the script:

local Seeker = playerCharacters[math.random(1, #playerCharacters)]
	print(Seeker)

	Seeker.HumanoidRootPart.Position = Vector3.new(130.046, 5.5, 0.84)
	Seeker = game.Teams.Seeker

May be the problem. You aren’t checking if the player is in the spectator role.

i changed it and it wont work. so any other ideas.

If you are returning a value in the if statement, try making it a function instead.

what do you mean?
this is the changes i added:

game.Players.PlayerAdded:Connect(function(plr)
	plr = game.Teams.Spectator
end)

local recol = 0


game.Players.PlayerAdded:Connect(function(amount)
	recol = recol + 1
	print("Added 1")
end)

game.Players.PlayerRemoving:Connect(function(amount)
	recol = recol - 1
	print("Lost one player!")
end)

if recol <= 2 then
	print("Sorry but the game has less than 2 players!")
	return nil
end

if recol >= 2 then 
	wait(20)
	
	local playerCharacters = {}

	for _, character in pairs(workspace:GetChildren()) do
		if game.Players:FindFirstChild(character.Name) then
			table.insert(playerCharacters, character)
		end
	end
	
	
	local Seeker = playerCharacters[math.random(1, #playerCharacters)]
	print(Seeker)
	
	if Seeker == game.Teams.Spectator then
		Seeker.HumanoidRootPart.Position = Vector3.new(130.046, 5.5, 0.84)
		Seeker = game.Teams.Seeker
	else
		if playerCharacters == game.Teams.Seeker then
			return nil
		else
			playerCharacters = game.Teams.Hiders
		end
	end

	end


so basically something like

function MakeSeeker()
        if recol >= 2 then
               Seeker = game.Teams.Seeker
        end
end

if seeker = game.teams.spectator then
        makeseeker()
end