Greetings everyone, I am working on a cutscene, and I need an npc to face the player all the time. I used cframe.lookat, which worked, but It ALWAYS faces the player, so its whole body would move to face towards the player.
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local runservice = game:GetService("RunService")
local rigroot = game.Workspace:WaitForChild("Rig"):WaitForChild("HumanoidRootPart")
runservice.RenderStepped:Connect(function()
rigroot.CFrame = CFrame.lookAt(rigroot.Position,character:WaitForChild("HumanoidRootPart").Position)
end)
It’s in a local script inside starter player scripts.
what i want is for the rig face the character, but not like in the video, where it looks up. I tried using an align orientation constraint, but it didnt work out for me.
Change the “lookAt” parameter of CFrame.lookAt so that instead of looking exactly at the player, it looks at the players’ X and Z value, while keeping it’s own Y value.