I need help optimizing my datapack badly.

I made a large datapack to play with my friends. We had 10 people on a high quality server, and it was very laggy. I could use help understanding how to optimize, but the only thing that would need optimization is tick.mcfunction, as it runs the other functions, so it would be ok to not optimize the others. I can send the whole tick.mcfunction, but for now, I will just send the general tick stuff + 1 of the custom items. The custom items are all the same, but with different abilities, so i can learn from what you tell me and apply that to the others.
Continue to help post