||```sqf
{
if (_spawnchance select 4 > floor(random 100)) then //attachments
{
_weapon = selectRandom _weaponArray ;
_compatibleItems = [];
{
_slot = getArray (configFile / "CfgWeapons" >> _weapon >> "WeaponSlotsInfo" >> _x >> "compatibleItems");
if (count _slot > 0) then {
_compatibleItems pushBack (selectRandom _slot);
};
} forEach ["MuzzleSlot", "CowsSlot", "PointerSlot", "UnderBarrelSlot"];
hint str _compatibleItems;
if (count _compatibleItems > 0) then {
_attachment = selectRandom _compatibleItems;
_holder = "WeaponHolderSimulated" createVehicle [0,0,0];
_holder setPos _x;
_holder additemCargoGlobal [_attachment, 1];
};
};
} forEach _buildingPos;




thx though