How to randomize the object count of created shapes

I want to randomize the count of cubes with every trigger. The distribution function dosen’t work with count. Also I tried instantiate, but I cant figure out how to use it with shapes created in the script, only with exsting scence…

Kind Regards

@zollfnn i recall one option is to toggle their visibility:

@Simplychenable Works great, thank you very much!