Happy to hear that helped.
Crash course in initializationAre you familiar with tags? There are two tags which are very special:
minecraft:tick and
minecraft:load. I'm sure you're familiar with the first one: it tells Minecraft to run a function over and over again, comparable to a repeating command block. You're going to need this.
The second though it also important: it tells Minecraft to run a function
once; when your game is starting or when your datapack got (re)loaded. That's what makes it the ideal option to separate your "initialization" routines with other stuff.
Example: I would dump that "
/scoreboard objectives add" command into a function of its own, and then define a tag which points Minecraft to that function. Now.. I made a (rather simple!) datapack a few weeks ago:
Herobrine miniboss. It's not too big: consists of 5 functions, 2 advancements and 2 tags. It might help you get a grasp on these tags.