I am making a placement system and when I try to clamp an object to the plot, the object doesn’t get clamped. Code:
function clacBounds(plot, position)
local lPos = plot.CFrame:pointToObjectSpace(position)
local min_x = -(plot.Size.X/2)
local min_z = -(plot.Size.Z/2)
local max_x = (plot.Size.X/2)
local max_z = (plot.Size.Z/2)
local x = math.clamp(lPos.X, min_x, max_x)
local z = math.clamp(lPos.Z, min_z, max_z)
local vector = Vector3.new(x, position.Y, z)
print(vector)
return vector
end