Hello! As I was placing down the finishing details for my placement system implementing increments, I came into an issue where X and Z values would display NAN values spontaneously. I’m not sure how, as I have had no prior experience with NAN values before, but I believe it has something to do with how I run computations the same time as I set the CFrame property. Any help and insight is really appreciated!
local angles = CFrame.Angles(0, 0, 0)
local cframe = CFrame.new(snapPos(raycast.Position.X, Settings.xIncrement), raycast.Position.Y + ghost.PrimaryPart.Size.Y/2, snapPos(raycast.Position.Z, Settings.zIncrement))
if cframe ~= cframe then
print(cframe)
return
end
ghost:PivotTo(angles*cframe)
--SnapPos function
local function snapPos(num, inc)
return math.round(num / inc)*inc
end
Output: