I have a question:
Is there a method or anything else which returns the face of a part my ray is pointing at, like Mouse.TargetSurface property but for Ray casting?

I am trying to get the Face or NormalId of a part my ray is pointing at.
I have tried using the Normal and LookVectors or Dot products and matching the angles but I just can’t figure out how it can help me.

For those wondering, the solution I found takes a Position and returns the closest surface form a Part.
it goes like this:

local function GetSurface(Part,Position)
local rel = Part.CFrame:pointToObjectSpace(Position) / Part.Size;
local relX = rel.X;
local relY = rel.Y;
local relZ = rel.Z;
local absX = math.abs(relX);
local absY = math.abs(relY);
local absZ = math.abs(relZ);
if (absZ > absY) and (absZ > absX) then
if (relZ > 0) then
return Enum.NormalId.Back
else
return Enum.NormalId.Front
end
elseif (absY > absZ) and (absY > absX) then
if (relY > 0) then
return Enum.NormalId.Top
else
return Enum.NormalId.Bottom
end
elseif (absX > absZ and absX > absY) then
if (relX > 0) then
return Enum.NormalId.Right
else
return Enum.NormalId.Left
end
end
return nil
end