Problem on placement system grid

So I’m making a placement system with a grid, but the model position just doesn’t want to fit with the grid

This is the code I’m using

local function GetSnappedVector(vector: Vector3, gridSize: number)
    if vector and gridSize then
        local canvas = plot.Canvas
        local canvasSize = plot.Canvas.Size / 2
        local primarySize = currentModel.PrimaryPart.Size / 2
        local relative = canvas.CFrame:PointToObjectSpace(vector)
        relative =
            (math.round(relative.X / gridSize) * gridSize),
            (math.round(relative.Z / gridSize) * gridSize)

        return canvas.CFrame:PointToWorldSpace(relative)

BTW: the texture it’s aligned but the problem comes with the grid calculation thing, I tried adding half of the grid size and it worked but it looks awful


can u show us a demo of the adding half of grind size thing

Try changing math.round to math.floor

Try using math.floor() to snap the object to the grid instead of math.round() as it rounds it to the nearest x^ and y^ value.