Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Fill a section / region with parts?

Asked by 4 years ago
Edited 4 years ago

Hello! I'm making a minecraft tool wich allows you to place blocks and i tried to replicate the WorldEdit plugin. Now, i have //undo, //up, //cut and //paste done. Since there is a //set command to fill an area with the block given i want to make it. Now the problem is that i don't know how i can do this. I searched it and there's nothing about it. My question is, how can i fill an area with 2 given positions? Something like Region3. Also, sorry for not providing code, but i don't know where to start from.

0
Build a Region3 from the two vector points specified by the tool, then fill in the space respectfully? Ziffixture 6913 — 4y
0
How can i fill a region3? maumaumaumaumaumua 628 — 4y
0
@Feahren maumaumaumaumaumua 628 — 4y
0
Maybe make a block, the size of what you want it to be, that follows the part around. Then when you click, the part is already there, and puts whatever block you want there. zandefear4 90 — 4y
View all comments (2 more)
0
I mean the block follows the mouse, not a part. zandefear4 90 — 4y
0
I want to fill an entire area with blocks of the size 3,3,3 and grid 3, the grid is easy, but as i said i don't know how to fill the area maumaumaumaumaumua 628 — 4y

1 answer

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago

I don't know if this is the best solution, but I recommend just quickly looping through the positions creating blocks.

local Pos1 = script.Parent.OneCorner.Position --Switch for your pos1
local Pos2 = script.Parent.OtherCorner.Position --Switch for your pos1

local BlockSize = 4

for x = (Pos1.X/BlockSize), (Pos2.X/BlockSize) do
    for y = (Pos1.Y/BlockSize), (Pos2.Y/BlockSize) do
        for z = (Pos1.Z/BlockSize), (Pos2.Z/BlockSize) do
            local NewBlock = Instance.new("Part")
            NewBlock.Anchored = true
            NewBlock.Size = Vector3.new(BlockSize , BlockSize , BlockSize )
            NewBlock.Position = Vector3.new(x*BlockSize , y*BlockSize , z*BlockSize )
            NewBlock.Parent = game.Workspace
        end
    end
end
Ad

Answer this question