If statement isn't working

Hello! SO currently, my if statement is not working. Any help would be appreciated, thanks! (it is erroring on the middle line.

			if #(Teams.Contestants:GetPlayers()) == 1 then
				ShowWinner.Text = Teams.Contestants:GetPlayers().Name .. " has won the round!"
			end

May you post the error message please? Thanks.
It will help with the debugging process.
Sceenshots or Text is fine

ShowWinner.Text = Teams.Contestants:GetPlayers()[1].Name .. " has won the round!"

“GetPlayers()” returns an array of players, you need to index that array (in this case you want the player instance which is located at index 1).

1 Like

Oops, my apology I didn’t read it.

if #(Teams.Contestants:GetPlayers()) == 1 then
	ShowWinner.Text = Teams.Contestants:GetPlayers()[1].Name .. " has won the round!"
end

You can’t index a specific player using GetPlayers() you have to index its place in the table.

Would I do the same here with that? I am trying to team every person ont eh Eliminated Team to the Contestant team

Teams.Eliminated:GetPlayers().Team = Teams.Contestants
for _, EliminatedPlayer in ipairs(Teams.Eliminated:GetPlayers()) do
	EliminatedPlayer.Team = Teams.Contestants
end

You’ll need to iterate over every player in the “Eliminated” team.