You can try something like this where the block looks at every enemy block from a list and returns the closest one and if its within a certain range then it actives some script
local MaxDistance = ???
local Block = ???
local EnemyBlock = ???
local CurrentEnemy, Dis
for i,v in EnemyBlockList do
if not CurrentEnemy or CurrentEnemy and Dis < (Block.Position - v.Position).Magntiude then
Dis = (Block.Position - v.Position).Magntiude
CurrentEnemy = v
end
end
if Dis <= MaxDistance then
--*does stuff with CurrentEnemy*
end