I need help with my gun datapack

I am trying to make datapack with guns, but i have problem with some things.

I dont know how to do semi auto guns. I tried with 2 scoreboard, but it was very delayed and wasnt working on guns with shorter cooldown so i deleted it.

I have no idea how to make dealing damage because when i do /damage player has "invulnerability time" and i cant hit him again.

And i dont know how make reloading and reload time similar to other stats. (i think about shedule but i dont know how to use this) [setting scoreboard ammo = max]

(sorry for my bad english)

Continue to help post