This is a job for the Step event, where you can test two conditions at once before creating anything.
Open the Step event of the object that does the shooting and add a code action along these lines:
if (mouse_check_button(mb_left) && keyboard_check(key_space)) { instance_create(x, y, obj_bullet); }
mouse_check_button is true for every step the button is down, so holding it produces continuous fire — perfect for a machine gun. Swap in mouse_check_button_pressed if you want exactly one shot per click, and replace key_space with the ord of whichever key you're using, such as ord('K').
Keep the bullet's sprite, direction and speed set inside the bullet object's own Create event so the spawner stays tidy.