Help With Object Placement for Walls and Vertical Surfaces!

Hey, recently for the past 2 days I’ve been struggling to create an effective “Placement System” (Similar to Bloxburg, Rovile, etc).

Now, I’m not Incompetent when it comes to scripting (3 years experience), but each time I’ve created one, multiple problems ensue.

The sysem requires the following:
Snaps to grid - Implemented
Stays within bounds (of the plot) - Implemented
**Stays within bounds (of wall object) ** - Struggling to implement successfully

it should work like so:

local a,b,c = Ray.Position.X, Ray.Position.Y, Ray.Position.Z
local X,Y = self:Bound(Vector3(a,b,c), Plot)

if Ray.Instance.Name == "Wall"  then
local Wall = Ray.Instance.Parent

b = math.clamp(math.floor(b / self.Grid + 0.5) * self.grid
Wall.CFrame.Y - Wall.Size.Y/2 + self.Model:GetExtentsSize().Z/2,
Wall.CFrame.Y + Wall.Size.Y/2 - self.Model:GetExtentsSize().Z/2

X = math.clamp(math.floor(X / self.Grid + 0.5) * self.grid
Wall.CFrame.X - Wall.Size.X/2 + self.Model:GetExtentsSize().X/2,
Wall.CFrame.X + Wall.Size.X/2 - self.Model:GetExtentsSize().X/2
b = self.Floor

it clamps axis Y but not X

1 Like