How to make math.clamp() make a boundary for building on your plot?

So here’s my problem in my build system… I want to make it so when you move your mouse across the plot the object stays on the plot’s part and doesn’t hangover. Currently, when you move your mouse it keeps the model on the plot but half of the model is not. This is my second time posting since no one responded. I can’t seem to get the max position of the plot and minimum through its cframe. The script is a part of the full script since people on the forum said it was “too long to go through” which I understand…

I’ve asked multiple times before and haven’t gotten an answer that fixed the problem. I’ve tried math.clamp() and it just made it so the object stays at the center of the plot and you can’t move it.

Here’s the script:


local function SnapToGrid(vector3)

return Vector3.new(

math.clamp( Round( vector3.X, Grid ), Plot.Position.X - 20, Plot.Position.X + 20),

Round(vector3.Y, 0),

math.clamp( Round( vector3.Z, Grid ), Plot.Position.Z - 20, Plot.Position.Z + 20),

print(vector3)

)

end

Any diagrams and pictures of the issue? Plus does your furniture/prop fit inside a square grid like 1x2 square or else?


Also, it’s in a 2 by 2 grid