How to rotate part to specific position without using lookat/lookvector (dot product)?

so i got this code

	local pos = target.PrimaryPart.Position
		model.PrimaryPart.CFrame =,,model.HumanoidRootPart.Position.Y,pos.Z))

what it does is rotate my model to the given position but the problem is when i use :Dot function, it return distance between target’s position itself not the distance between model and target
also here’s the code i use

local result = {}
		for i,v in pairs(list) do 
			if v.HumanoidRootPart and v.Humanoid then
				local pos = v.HumanoidRootPart.Position
				local preferredDirection = 
				local deltaPosition = pos -tower.HumanoidRootPart.Position 
				local actualDirection = deltaPosition.Unit
				local distance = deltaPosition.Magnitude
				local angleDifference = math.acos(actualDirection:Dot(preferredDirection))
				local Angle = tower.Power:FindFirstChild('ConeAngle')
				if distance < minrange and math.deg(angleDifference) < Angle.Value then
					result[#result+1] = v
		return result

anyone know how to fix this?

could you explain what your trying to do?

what i think i can see is you have towers and each tower has a coneangle and you want to check if the player is inside the towers coneangle correct?

if that’s the case maybe this will help

local attackRange = 100
local attackFov = 45

-- get half of the attack field of view in radians
attackFov = math.rad(attackFov) / 2

local function InsideAttack(tower, character)
    -- get the direction vector from the tower to the character
    local direction = character.PrimaryPart.Position - tower.Position

    -- if the distance is grater then attackRange then return false as the tower can not attack the character
    if direction.Magnitude > attackRange  then return false end

    -- get the angle from the towers look vector to the characters direction
    local angle = math.acos(tower.LookVector:Dot(direction.Unit))

    -- if the angle is grater then the attack FOV then return false
    if angle > attackFov then return false end

    -- all checks have past we can now return true
    return true