I suck at lua (and scripting in general) so you will have to wait for some else to help you here.
But you can take a look at the luadocs, if you haven't already:
The position of a character should be something like: Characters["Person_A"].Position
Are both of the characters moving? If not - I would go the easy route and use an action area. When the moving character enters the area start the action.
Edit:
... just did a little check:
function queryDistance()
local Person_A = Characters["Person_A"].Position
local Person_B = Characters["Person_B"].Position
local distance_x = Person_A.x - Person_B.x
local distance_y = Person_A.y - Person_B.y
if distance_x <= 50 and distence_y <= 50 then
startAction("Actions[]")
end
end
registerEventHandler("mainLoop", "queryDistance")
should work. But you would need to add a condition to stop the loop