I'm trying to edit a CFrame resize script so that I can make a building plugin for myself. It didn't resize in decimals so I edited it and it works fine when you're making a part bigger but not when you are making it smaller. The number will double(i think its actually just being rounded to the nearest whole) when you make it smaller but it works fine when making it bigger.
if tostring(side) == "Enum.NormalId.Right" then
local delta = (distance - (distance % GridSize)) - (lastDistR - (lastDistR % GridSize))
local d2 = distance - lastDistR
if d2 > GridSize then
local newDist = delta
local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi/2)
local lv = cf.lookVector
local cf2 = part.CFrame
local size = part.Size
part.Size = Vector3.new(part.Size.x + newDist, part.Size.y, part.Size.z)
if part.Size == size then
part.CFrame = cf2 + lv * (0.5*newDist)
cf2 = part.CFrame
end
part.CFrame = cf2 + lv * (0.5*newDist)
lastDistR = lastDistR + newDist
else
if d2 < -GridSize and part.Size.x + d2 < GridSize then
local newDist = -(part.Size.x - GridSize)
local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi/2)
local lv = cf.lookVector
local cf2 = part.CFrame
local size = part.Size
part.Size = Vector3.new(part.Size.x + newDist, part.Size.y, part.Size.z)
if part.Size == size then
part.CFrame = cf2 + lv * (0.5*newDist)
cf2 = part.CFrame
end
part.CFrame = cf2 + lv * (0.5*newDist)
lastDistR = lastDistR + newDist
else
if d2 < -GridSize and part.Size.x + d2 > 0 then
local newDist = delta
local cf = part.CFrame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), -math.pi/2)
local lv = cf.lookVector
local cf2 = part.CFrame
local size = part.Size
part.Size = Vector3.new(part.Size.x + newDist, part.Size.y, part.Size.z)
if part.Size == size then
part.CFrame = cf2 + lv * (0.5*newDist)
cf2 = part.CFrame
end
part.CFrame = cf2 + lv * (0.5*newDist)
lastDistR = lastDistR + newDist
end
end
end
end
