Is there anyway I can make the npc turn slowly towards the player? Currently the npc just suddenly turns towards the player (if you really need a video ill try to provide you with one)
Code I use to turn the Npc:
local NPCroot = npc.HumanoidRootPart
local Character = player.Character
local CharRoot = Character.HumanoidRootPart
Npc:SetPrimaryPartCFrame(CFrame.lookAt(
NPCroot.Position,
CharRoot.Position * Vector3.new(1, 0, 1)
+ NPCroot.Position * Vector3.new(0, 1, 0)
))
Nah you can still use it, I needed it for my flying script. It’s realy easy to use and sometimes its better to use bodygyro/bodyposition
For example, you can’t use alignorientation to align something like the character’s head to the camera because you can’t add an attachment to the camera. The only possible way to do that would be to constantly set a part’s CFrame to the camera’s CFrame with a while loop.
Same for bodygyros but atleast you don’t need to do that, plus much simpler to use.
Although the best solution in this case would be to use tweenservice.
-- code not complete, i just provided a placeholder
local goal = {}
goal.CFrame = CFrame.lookAt(NPCroot.Position, CharRoot.Position * Vector3.new(1, 0, 1) + NPCroot.Position * Vector3.new(0, 1, 0))
-- your tween info
local tween = TweenService:Create(NPCroot, tweenInfo, goal)
tween:Play()