Lag on my datapack

This is a datapack for Minecraft 1.16.5, it's for a small survival with friends (it is custom buffs and one skill for certain players) wich i'm the host, i've been making it with AI and with basic knowledge in commands, for some reason, it causes lag, and I don't know if the problem is due something not related with the datapack, Could someone give me advice, correction or a solution?

Continue to help post