There are ways to have objects included/excluded from actions. How exactly will depend on what kind of thing you want to be selective for, such as colliders (so an object is a ghost for some things but hits others), ray casting, and Mouse Pick.
You said click on. Are you using a Mouse Pick Event?
If you are using Mouse Pick Event; First create a new layer to put objects for mouse pick to ignore in. Then in the Mouse Pick Event action, change the Layer Mask to 1. This will now allow you to select a layer to ignore. Choose the one you just made. Mouse pick now works on all layers but that one. You can also flip the mask, which means you will pick what you only want it to work with. Last step is to change the layer for the objects you want to ignore, or if you flipped, want to only use.
If you aren't using Mouse Pick Event, what exactly are you trying to use? There will be a method the same or with a similar result to this for any action you use.
As for random chance, to hit; I haven't done any random things like that, but thinking up a system off the top of my head would go like this:
* Chance is between 0 and 100. It will be represented and interacted with by Ints
* Have a nerf Int ("x" in this example) which may start at 0 (if you start with 100% of being hit)
* When something reduces your chance to be hit, like you are behind cover or etc, add to your nerf (x) Int. So maybe you reduce your chance by 10% (which is 90% chance to be hit), so you add 10 to nerf
* Add for every thing that would reduce your chance of being hit, so this X int keeps building up.
* Conversely, you may also have modifiers which reduce this int. Like maybe you can do things to reduce your chance, but the enemy can do things to increase the chance. Just add or minus accordingly.
* Generate a random Int between 1 and 100 (this is "y" in this example)
* Int compare Y to X
* If Y is greater than X, you have been hit.
* If Y is smaller or equal to X, the shot has missed
For example, you reduce your chance by 10%, so your X is 10. That means you have 10 chances out of 100 to not be hit (1,2,3,4,5,6,7,8,9,10 as the int result), and 90 of being hit (11,12,13,..etc..,99,100). So if it produces 15 as your random int, you landed on part of the 90% chance of being hit.