I need to fix float points issues with CFrames, as it’s meaning blocks are janky when placed, and also for data saving purposes (I don’t wanna save a dozen random numbers, when all I need is a single number)
I tried to create this function, but I get Invalid number of arguments: 4 on FixedCFrame, and I also worry that this would break my slabs. Every block is 3x3x3, but slabs are 3x1.5x3, and fear it could break their placement. Either way though, this doesn’t work. I need all numbers of the CFrame to be like this too, as when I rotate parts, their lookvectors and what not also go off
function Helpers.FloatFix(cFrame)
local Position = Vector3.new(
math.floor(cFrame.Position.X),
math.floor(cFrame.Position.Y),
math.floor(cFrame.Position.Z)
)
local LookVector = Vector3.new(
math.floor(cFrame.LookVector.X),
math.floor(cFrame.LookVector.Y),
math.floor(cFrame.LookVector.Z)
)
local RightVector = Vector3.new(
math.floor(cFrame.RightVector.X),
math.floor(cFrame.RightVector.Y),
math.floor(cFrame.RightVector.Z)
)
local UpVector = Vector3.new(
math.floor(cFrame.UpVector.X),
math.floor(cFrame.UpVector.Y),
math.floor(cFrame.UpVector.Z)
)
local FixedCFrame = CFrame.new(
Position,
LookVector,
RightVector,
UpVector
)
return FixedCFrame
end
print("New", NewCFrame)
local FixedCFrame = Helpers.FloatFix(NewCFrame)
self.CurrentBlock:PivotTo(FixedCFrame)
New 6, 3.00099993, 5000, 1, 0, 0, 0, 1, 0, 0, 0, 1