How would I add increments to my building system? For example increment 1 is 1 stud of movement and 2 is 2 studs etc.

What is the issue? Can’t figure out.

What solutions have you tried so far? I’ve tried putting my increment value everywhere but it doesn’t seem to work, also looked on the devforum.

obj = transBlock
local ignrlst = {Player.Character, obj.PrimaryPart}
local pos,target,norm = FindPositonForPart(ignrlst)
if pos ~= nil then
local x = math.floor(pos.X + .5)
local y = math.floor(pos.Y + .5)
local z = math.floor(pos.Z + .5)
local rpos = Vector3.new(x,y,z)
if rpos and norm then
local npos = rpos + norm
obj:SetPrimaryPartCFrame(CFrame.new(npos))
end
mTarg = target
end

To round you may use math.round() as it is the same as math.floor(x + .5).

I believe using modulo may be an appropriate approach, it will give you what is missing to make it evenly divisible.

If you have an increment of 2 then only numbers divisible by 2 would be allowed. I think you might be able to do something like this:

function f(inc, val)
val = math.round(val)
local diff = val % inc
return math.round(val + diff/2)
end
print(f(2, 2.5)) -- Prints 4

This is not exactly what you wanted, but this is a perhaps a good starting point for you. Currently it will round anything from from .5 and up to the next interval, but you can probably fix this with some minor adjustments.

local function RoundNumberToNearestMultipleOfN(Number, N)
return math.floor(Number / N) * N
end
print(RoundNumberToNearestMultipleOfN(15, 7)) --14
print(RoundNumberToNearestMultipleOfN(10, 3)) --9