Please help with the diagram

Sounds like you need to start with the 2nd example in this post: I can't understand how the RANDOM block works, but run gate output to SET instead of TGL on flip-flops. This would allow the same target to pop up twice in a row.

If you only want one target to show at a time, then you should replace clock signal to random node with pulse from code telling you there has been a hit (so next target raises after previous target has been hit).

The output of flip-flops should feed if-else to determine servo position. False should be lowered position; True should be raised position. Actual values will depend on servo orientation, but will likely be 0 & 0.5, or 0.5 and 1 (or reversed if servo is flipped the other direction).
image

The reset button should RST all flip-flops as well as count of hits & cartridges. Since a hit will also RST flip-flops, you will need an “any” node to allow either pulse to reset each flip-flop.

To count cartridges remaining, it is difficult with existing XOD nodes to do a count-down from a specific number, but you can “fake” it using count up & subtract from max number. For example, assuming a 6-shooter:
image
Output of subtract is the number of cartridges left.

For the photo-resistors detecting hits, you will need a voltage divider circuit. The analog pin will connect to photo-resistor and a 2nd fixed resistor. The 2 resistors will connect to V+ and GND. Assuming the photo-resistor connects to V+, the reading on the analog pin will increase as light on the detector increases. You will need to do some testing to determine how high the value gets for a hit and how low it goes for ambient light. Somewhere between those values (probably closer to the hit value) is what you want to compare with to determine if there is a hit:
image
The output for “greater” will go true when there is a hit. If only one target is up at a time, you can use “or” to join all 4 detector “greater” outputs into one hit signal. That pulse should 1) increase counter for hits, 2) reset flip-flops, 3) pulse random to raise the next target. Cartridge count is decremented every time the gun is fired; it doesn’t matter if there is a hit or not.

Note that you probably want a gate node between hit detection and random so it can be disabled when cartridge count reaches zero. You will also want to disable the gun firing so they can’t hit last target after cartridges are gone.

This assumes detectors are hidden when targets are down, so there is no need for extra code to only count hits on targets that are up…it will be impossible to detect a hit when target is down. This also assumes light is emitted from gun only when it is fired; if gun is always shining light, then you need to detect hits only when “FIRE” pin is activated.