Roblox Luau uses double precision floating point variables for storing numbers.

This means, in Your case, that if the number is not divisible by 6 you will end up with approximate number and not the precise value. This in turn may cause unpredictable (or rather really hard to predict, without inner knowledge of the floating point notation) behaviour in edge cases.

To fix it, You should add an extra leeway to Your condition. Since Your game is block based, the ideal extra should be half of the block size.

Assuming each block has 1 stud width/length, here is the solution:

if (math.abs((OreCF.Z-Origin.Z)/6) >= (16 + 8 + 0.5)) or (math.abs((OreCF.X-Origin.X)/6) >= (16 + 8 + 0.5))

Thank you for this but this isnt my problem, the problem im having is that on some sides the barrier works and on some dont the. entire place is 16 by 16 and each block is 6x6x6 thats why i divide it by 6
so its basically checking the amount of blocks.

By putting actual numbers to Your formula, You can see for yourself that it does in fact work. So the problem MUST be with either incorrect Origin or OreCF.

As long as Origin is in the middle and OreCF represents actual block it will work as intended.

The only thing that can be wrong is incorrect origin or maybe your OreCF. (Also, why you use X-Origin.X and Z-Origin.Z, but not single Vector3 Origin.X and Origin.Z ?)

You guys are trying to solve a problem i don’t have. I have 16 + 8 because later i will implement a variable that i can customize and Origin.X is the X cordinate the first block starts at.

I dont think you guys see what is happening on the image and what the title means. Im trying to make a barrier so every block on the barrier level will become air or later something unbreakable.