Vision Sensor Explanations?

I have a basic code for the flags but i’m having trouble using it for cubes.

What does the code look like?

I’ve noticed that the vision sensor has a really tough time with the purple and green cubes, I haven’t really found a fix for it, so as of right now I don’t plan on using vision for tower takeover