How do I make the Character look in the same direction as the camera?

What can I do to make the character look in the direction the camera is looking when doing the animation? I tried to put the CFrame lookvector of the camera to the HumanoidRootPart, But apparently it didn’t work

-- Didn't work? --
Character.HumanoidRootPart.CFrame =Character.HumanoidRootPart.CFrame * CFrame.new(Character.Torso.CFrame.Position, Character.HumanoidRootPart.CFrame.Position + CameraLookVector, 0)

Look at this topic:

Try this :

local localplayer = game:GetService("Players").LocalPlayer
local character = localplayer.Character
local root = character:WaitForChild("HumanoidRootPart")
local gyro = Instance.new("BodyGyro", root)
gyro.MaxTorque = Vector3.new(9e9, 9e9, 9e9)
while wait() do
    gyro.CFrame = workspace.CurrentCamera.CFrame
end

If you want to make it turn faster, put gyro.P = 10000 in it. You can set 10000 to how fast you want it to turn your body

As far as I can understand this is what you are looking for

game:GetService("RunService").RenderStepped:Connect(function()
	local x,y,z = workspace.CurrentCamera.CFrame:ToOrientation()
	script.Parent:SetPrimaryPartCFrame(CFrame.new(script.Parent.PrimaryPart.Position)*CFrame.Angles(0,y,0))
end)
local Game = game
local Workspace = workspace
local RunService = Game:GetService("RunService")
local Players = Game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = Workspace.CurrentCamera

local function OnRenderStep()
	Character:PivotTo(CFrame.new(Character:GetPivot().Position) * Camera.CFrame.Rotation)
end

RunService.RenderStepped:Connect(OnRenderStep)

Compatible with both R6 and R15 avatar types. You can set the camera’s type to ‘Scriptable’, then run the code within a loop which matches the length of the animation’s duration and then set the camera’s type back to ‘Custom’.

2 Likes