CFrame.frommatrix problem

hi iam trying to make part facing to part but its caused error , please help me thanks

heres the code

local Part = workspace.RealPart
local Part2 = workspace.RealPart1
local UpVector = Part.CFrame.UpVector
local Tween = game:GetService("TweenService")
local Table = {}


local NewPart = Instance.new("Part",workspace)
	NewPart.Anchored = true
	table.insert(Table,NewPart)
	NewPart.CFrame  = CFrame.fromMatrix(Part.Position,Vector3.new(0,0,0),Vector3.new(0,0,0),NewPart.CFrame.UpVector:Cross(NewPart.CFrame.RightVector).Unit)
warn(NewPart.CFrame:components())	




heres the components:
-13.799987792969 0.5 -1.5999755859375 -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind) -nan(ind)

Use CFrame.lookAt instead.

NewPart.CFrame  = CFrame.lookAt(Part.Position,Part2.Position)

If you want to use CFrame.fromMatrix in a similar manner follow this tutorial and use this function from the tutorial. However there is no longer any reason to use this method as CFrame.lookAt exists now, but it’s pretty interesting to know how CFrame.lookAt is done internally mathwise with CFrame.fromMatrix.

local function getCFrame(position, lookAt)

    local lookVector = (position - lookAt).Unit 
    local modelUpVector = Vector3.new(0, 1, 0)
    local rightVector = lookVector:Cross(modelUpVector)
    local upVector = rightVector:Cross(lookVector)

    return CFrame.fromMatrix(position, rightVector, upVector)

end

Okg thank you , ima give u a resolution UwU