How can i make my character look towards the camera?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Im making my own shift lock with more smooth turns.

  2. What is the issue? Include screenshots / videos if possible!
    The code im using turns my character in the y axis, but i dont want that.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I Tried using CFrame.Angles, LookVector, LookAt, but im not good at maths to make it work.
	local t2 = TS:Create(Hrp, TweenInfo.new(0.05, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {CFrame = CFrame.new(Hrp.Position) * Camera.CFrame.Rotation})
		t2:Play()

If hrp is the local you have that stores character humanoid root part inside of it, then solution is probably this:

local t2 = TS:Create(Hrp, TweenInfo.new(0.05, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {CFrame = CFrame.new(Hrp.Position) * CFrame.new(Camera.CFrame.Rotation.X, Hrp.CFrame.Rotation.Y, Camera.CFrame.Rotation.Z)})
t2:Play()

Basically, you change player’s angle to every angle of camera rotation but the Y axis, and keep it the same.
(i could have made a mistake since i rarely use rotation parameter of cframe)

if this doesn’t work I have a script that does the same thing and works

i tried it but the character don`t turn

wait()


local Ang = CFrame.Angles
local aSin = math.asin
local aTan = math.atan


local Cam = game.Workspace.CurrentCamera

local Plr = game.Players.LocalPlayer
local Mouse = Plr:GetMouse()
local Body = Plr.Character or Plr.CharacterAdded:wait()
local Head = Body:WaitForChild("Head")
local Hum = Body:WaitForChild("Humanoid")
local Core = Body:WaitForChild("HumanoidRootPart")
local IsR6 = (Hum.RigType.Value==0)	--[Checking if the player is using R15 or R6.]
local Trso = (IsR6 and Body:WaitForChild("Torso")) or Body:WaitForChild("UpperTorso")
local Neck = (IsR6 and Trso:WaitForChild("Neck")) or Head:WaitForChild("Neck")	--[Once we know the Rig, we know what to find.]
local Waist = (not IsR6 and Trso:WaitForChild("Waist"))	--[R6 doesn't have a waist joint, unfortunately.]



local UpdateSpeed = 3

Neck.MaxVelocity = 1/3

Hum.AutoRotate = false
game:GetService("RunService").RenderStepped:Connect(function()
	Core.CFrame = Core.CFrame:lerp(CFrame.new(Core.Position, Vector3.new(Mouse.Hit.p.x, Core.Position.Y, Mouse.Hit.p.z)), UpdateSpeed / 2)
end)

starter character script local script

2 Likes