table of contents doesn’t work
Please, improve your question: click on … under it, then on the “pencil” icon to enter edit mode (this site is not a forum, you can edit your question; this groups all relevant information in a sngle location).
Presently, your question is equivalent to “I have a problem” without telling which.
Mention OS name, LO version and save format. Attach your document for more detailed analysis.
Modify also the tag: since you’re asking about TOC, this is not a common question because there is no TOC in Calc, Draw, Impress, Base and Math. Use writer and other more specific tags such as table-contents