Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Fill a section / region with parts?

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.

6 comments

0

Build a Region3 from the two vector points specified by the tool, then fill in the space respectfully?

0

How can i fill a region3?

0

@Feahren

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.

0

I mean the block follows the mouse, not a part.

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

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.