hey im still a new coder and decided to go my own path and make games from what i know (extremly basic code) but i need to shoot bullets from a spawner at the end of my turrets barrel, the barrel rotates left and right when holding a key so what code do i add to make it shoot?
Generally you make a prefab of the moving parts of your gunbase, or just make an entire scene.
You would parent the gun barrel to the turret pivot, etc.
Then you stick a GameObject (also parented) where you want the muzzle to spawn, and point that GameObject so that its +Z axis (blue) is the bullet direction.
Now just use that GameObject (or technically its Transform) to know where and which direction to shoot.