How can I improve this monstrosity ?

Basically what I want here : I want to launch a bunch of arrows facing where the player is looking (basically making a minigun sentry turret sort of thing, like that one ability in wynncraft) Problem : I cannot give an arrow the rotation of the player. Either by "tp ~ ~ ~ ~ ~" or "tp ~ ~ ~ facing ..." or "data arrow rotation set from player rotation". Nothing works. From my research, arrow's rotation is defined by its motion and cannot be override relatively from another entity. But it can be rotated using hard-coded numbers like with the "tp ~ ~ ~ 90 0" that i'm doing in this screenshot What solution I chose : Hard-coding every rotation the arrow, every 10 degree, based on the rotation of the player (RotationX score). If player Rotation X is between 86 and 95, then summon arrow with Rotation -90 etc It works fine like this btw (for some reason an arrow's rotation is inversed from a player) Obviously this is horrible to manage, its not modulable, and this function is being called every 2t everytime I want to make the player do the minigun, its not lagging yet but it can't be the most optimized thing to do ? Do you have any idea ? I've tried a lot of different things and nothing works, and no one is really having the same problem as me on the internet Thanks in advanced !
Continue to help post