Fixing a Walls corners (user generated)

I’m attempting to fix the current but I’m having where users can’t connect there walls properly. I’d like the user to be able to create clean cut corners that connect properly and cleanly with other walls.

Here is an example of what I have so far and how it doesn’t properly connect corners…

Does anyone have any ideas of what I could do to fix this?

This is my placement module for walls which includes the snaps etc…

local WallModule = {}
local Wall = {}
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

function Wall:DrawWall()
	local newWall = self.DecoyWall:Clone()
	newWall.Parent = game:GetService("Workspace")
	newWall.Transparency = 0

function Wall:findSnapPoint(InputPosition)
	local GridSize = self.Snap
	local XPos =  math.floor(InputPosition.X / GridSize + 0.5) * GridSize
	local ZPos = math.floor(InputPosition.Z / GridSize + 0.5) * GridSize
	return, InputPosition.Y, ZPos)

function Wall:Delete()
	if self.DecoyWall then
	self = nil

function Wall:SetEndPoint(Pos)
	local SnapPos = self:findSnapPoint(Pos)
	self.EndPos = SnapPos
	SnapPos = SnapPos +,5,0)
	local startPos = self.StartingPos +,5,0)
	local distance = (startPos - SnapPos).Magnitude
	self.DecoyWall.CFrame =, SnapPos)
	self.DecoyWall.Size =,10,distance)
	self.DecoyWall.Position = startPos + 0.5*(SnapPos - startPos)

function Wall:SetStartPoint(Pos)
	local SnapPos = self:findSnapPoint(Pos)
	local DecoyWall ="Part")
	DecoyWall.Anchored = true
	DecoyWall.Name = "DecoyWall"
	DecoyWall.Size =, 12, 1)
	DecoyWall.Parent = game:GetService("Workspace")
	DecoyWall.Position = SnapPos +, DecoyWall.Size.Y / 2, 0)
	DecoyWall.Transparency = 0.3
	self.DecoyWall = DecoyWall

function WallModule.New(Plot, StartingPos, SnapSize)
	local wall = setmetatable({
		Plot = Plot,
		StartingPos = StartingPos,
		EndPos = nil,
		Snap = SnapSize,
		DecoyWall = nil,
	}, {
		__index = Wall
	return wall

return WallModule

Your system works lovely, but if you want to solve your issue, I’d suggest using a grid and wall rotations such as 0,45,90 etc to prevent these gaps.


This was a consideration that I ended up shooting down when making this. The entire point of this project is to allow my players to have complete control over building with ease and I feel like adding limitations like that will really take away from the grand scheme of things.


What I would recommend is checking if two walls collide (and approximating what end they are touching at, using position, size and rotation) and then doing math to re-position it slightly so that they connect how you want them to.


I really don’t want to reposition them though, I’d much rather just have them scale to the right sizes and connect but I don’t know how to do this.

1 Like

Have you tried looking at the code for the ResizeAllign and GapFill plugins??


I looked in to the code of ResizeAllign and it has what I want however I have no clue how I’d implement this in to what I’m working with.


wouldn’t you just create a variable for the last wall placed, then connect the whatever code is inside the ResizeAlign to the new wall placed? haven’t looked inside the ResizeAlign code so i’m not sure if that would work or not…

1 Like

Using ResizeAlign it requires a face, I also want all walls to connect not just the last placed wall and the newly placed wall.

1 Like

Perhaps a cylinder at the end where a new wall is created from a corner will fix this problem? It’s not elegant but at least works.

Otherwise, you could deal with size maths after placing the 2nd wall. Assume first wall is A and other wall is B. Then we have to find the outer corner that ‘could’ connect between A and B. Note that A and B requires the face facing ‘outwards’.

After that, calculate magnitude between the edge of the wall opposite to the corner to the edge of the corner. Subtract the length of the side and put them into two different variables and add them to the size of the length of the wall. We have the wall sizes!

Now when the size is acquired, you have to reposition it too. Local space CFraming would fix this problem. Take the half of the size of aforementioned variables(the extension) and move them towards the corner using CFrame.

Note: This may contain a lot of decimals after creation of the corner.

I hope this solves the problem trying to read the ResizeAlign code.

1 Like

Another thing you can do instead is have a GUI which you can decide the numbers such as grid size, rotation angles, etc. Might be useful and allow to build with ease and could possibly fix the issue though…

Edit: Reposted since I accidentally replied to wrong post :sweat_smile:

1 Like

I’m sort of following what you’re saying here. The problem is getting the corners that need to be sized however.


For sized corners, you could have additional parts to the corners. Imagine a sequence pattern. It has a start and end sequence. Using CFrame to determine where the end is(and offsetting from it) can probably create those sized corners.

If this is not what you’re looking for, I must have misinterpreted the expected result.

1 Like

My OOC contains two values if this is what you’re referring to,


I’m not entirely sure what you’re talking about with additional parts to the corners? I’m just looking to scale one end up or down in order to meet the other part and make a smooth corner without any overlapping

1 Like

You need to base your position/rotation on the different corners depending on if the relative rotation is positive or negative, instead of the center (grid snap).

1 Like

I’m not entirely sure if that’s what I need.

I’m really just trying to find out what two faces need to be resized, from there I can use the code from ResizeAlign

1 Like

Then either that is the same as my comment or I have misunderstood the issue.

1 Like

I guess I’m the one that misunderstood.

I don’t entirely understand you mean by your comment I guess.

1 Like

I know that dont with the topic but i really want to know how to make that game where u can build you own house with u script…