In the BP_PlayerInventoryComponent create a new variable call it Starting Weapons and set the variable type to S_WeaponInventory and set the variable to an array.

Next go to the Add Starting Items function and copy the image below

To use this you will still need your weapon in the starting items array, for example M4A4 with and index set to 0. Then in the Starting Weapons array add a new entry and set the index to 0. The index must be the same as the weapon you want to use the information from the Starting Weapon array. Then you can set the condition, ammo and attachments. You do not need to set the inventory variable in the Starting Weapons. Make sure you only use attachments that the gun can use if you dont you may get errors.