can someone help me with function?

Ahi im working on datapack that adds nanosuit mk1 from game crysis 1 and im almost done with everything but i need to make trigger that switches through modes. And also i need to make so when player in specific mode he emmits particle but for now for some reaseon when player in any of modes particles emmits at world spawn block but if i run command manualy everything is ok. i have hud that i display with bossbar to show energy bar but it dose not likned with scoreboard.
Continue to help post