I want to figure out how to make it so when I click on my NPC’s torso to talk to them, they turn my way. It would add a nice level of interactivity. Here’s my script:
This is correct, but just one note to prevent the Npc from falling over.
local from = NpcsTorso.Position
local too = PlayersTorso.Position
local pointDirection = (too-from) * Vector3.new(1,0,1)
NpcsTorso.CFrame = CFrame.new(from, from + pointDirection)
With the existing code - if the player is above or below the NPC - the NPC will look up/down and fall over as a result.
The correction above sets the Y (up/down) value relative to the NPC’s Y position. This means its always pointing level with the NPC and won’t fall over.
I’m just saying this in case you encounter the same issue in the future, for example, you shouldn’t use Humanoid:LoadAnimation() but Animator:LoadAnimation(). Since it’s deprecated, Roblox will care more about it’s replacement.