How can i make this barrier for mining work

Yes OreCF.X - Origin.X is a minus so i can get the right amount of blocks from the first one if that would not be the case on like a cordinate X 6000 i would have 1000 blocks which would not be the case if the origin X is at 5000

Then, your block place will be 47 blocks wide (23 solid blocks by positive and negative axis + zero block = 47 blocks on line. (and X==8 or Z==8 will nullify first 2 checks). I think now that you just expect diffirent block bounds.

I just want to make it so after 8 blocks on any side it will turn into air.

local X = math.abs(OreCF.X-Origin.X)/6
local Z = math.abs(OreCF.Z-Origin.Z)/6
if X >= 8 or Z >= 8 then return end

This should prevent blocks from spawning after 8th block (including 8th)

This is what happened when i used this formula:

Can you show me dot where Origin (0, 0) is?

As I understood, now it turns into air blocks when X or Z >= 8?


This should show you how it is supposed to work

The yellow line is what i mined.

Then I think everything ok? you mined 16 blocks total an met air?

I mined 8 blocks from the origin

and met air. IS that what you want or not???

Yes i want a formula that can do that.

:neutral_face: what wrong with this then??? Code checks if coordinate bigger than 8.

Because it creates something like this

So, it’s have 8 blocks on one side, and not 8 on another?

Its basically the same as this

But worse

what wrong on this image then? I can’t understand what’s incorrect, your images looks good.

image
This is the normal one
image
And this one is yours

And this is what i want to achieve

Red is origin

Yellow is blocks i need to mine to get to the barrier

Purple is Air.