The script itself works, yes, but still have one problem.
Like I said before, the guard should be able to see you, whether lit or not, and being lit only makes you more visible. That's the way it should be.
In the new 1.1 version, if guard has light=true, then being in the dark will render you completely invisible to the guard, which is just absurd. But if a guard's setting does not include light=true, then the "lit makes you more visible" part does not work at all. As the guard's range remain the same regardless of lit or not, lights around the map become pure decoration instead of level design element. Not everyone is running around with a flashlight all the time, you know.
To sum it up, they should able to see you from far away when you are in light, and must still able to see you when you are close enough without light. The current version can only do one or the other. That's the problem.
Although I have to admit, this might be a bit too much to ask. I'm already pretty happy with the current version, so it's okay if you feel there is no need to improve it.