Rotating HRP sometimes works (not always)

So I’m making a Tower Defense game and when an enemy enters the range of the unit, I want the unit to turn towards the enemy, but only sometimes does this work not all the time.

Here is my code:

v:SetPrimaryPartCFrame(CFrame.new(v.PrimaryPart.Position,target.CFrame.Position))

v is the model of the unit, and target is the enemies hrp

use Humanoid:PivotTo(CFrame) instead

1 Like

I concur with UnnaturalWater’s answer.
SetPrimaryPartCFrame is deprecated; PivotTo is the way to go.