Proximity code for chat script

I am currently using this script nb-rpchat) and the creator made an odd proximity script for it. My issue is, the code doesn’t work all the time, there is always one person in the server who can see all messages or all messages can be seen by.

So what I’m asking is, can anyone help me remove the code about proximity from this script, and add a more effective way to send proximity messages?

Edit the ProxDetector function in rpchat.lua