My code works fine until I get to line 8, and it gives the error shown above. I have no idea how to fix this, and any help is appreciated. Please note this is not the full code.

for _, player in pairs(activecontestants) do
		if player and player.Character then
			local humanoid = player.Character:FindFirstChild("Humanoid")
			if humanoid then
				humanoid:UnequipTools()
				player.Backpack:ClearAllChildren()
				humanoid.Health = 100
				gameState.Value = "The winner(s) are " .. activecontestants[player.Name]
				local lobbyspawns = workspace:FindFirstChild("LobbySpawns"):GetChildren()
				player.Character:MoveTo(lobbyspawns[math.random(1, #lobbyspawns)].Position)
			end
		end
	end
end

2 comments

0

Only strings can be concatenated. just read the error.

0

activecontestants[player.Name] might be nil. Try putting "print(activecontestants[player.Name] )" just before the line that errors, to see what you're trying to concat.