Rotating a NPC to look at another NPC doesnt always look at it in certain positions

So im making a Tower Defense game based around noobs and guests, though, im having a problem making the noobs look at the guests, basically, in certain positions the noobs will get stuck in another orientation that isnt looking at the guests, yet, it only happens at those certain conditions, in the video, we can see that the top noob doesnt suffer at all from this bug but the bottom one does.

I used CFrame.fromMatrix() to accomplish this, also tried CFrame.new(Target,eye) which gives the same outcome as stated and CFrame.LookVector doesnt work at all, here´s the code:

module.Aim = function(Guest ,Tower) -- guest = target / tower = eye
     local forwardVector = (Guest.Position - Tower.PrimaryPart.Position).Unit
     local upVector = Vector3.new(0, 1, 0)
     local rightVector = forwardVector:Cross(upVector)
     local upVector2 = rightVector:Cross(forwardVector)

     return CFrame.fromMatrix(Tower.PrimaryPart.Position, rightVector, upVector)
end

Could we see what you do with the output from that function? It might be helpful to see how it fits into the rest of your project

The output of the function is a CFrame that makes the noobs look at the guest, the problem is that the noobs at the bottom dont always look at the guests while the guests at the top do, but they are running from the same script

Sorry, I wasn’t clear, would it be possible to see the code that shows exactly where you call the above function and how that CFrame is used to make the noobs look at the guest. :slight_smile:

Note that all the towers run from the same script and same modules, which is weird cause teh top towers do work but the bottom ones work partially in the aiming