Help with Camera lock

Hey, I’m having an issue with my code currently.

I’ve made the camera so it makes your Character face the same direction. The only issue I get is this:

Whenever I make it not set the Humanoid Root Part orientation on the X it just stops working entirely.

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
local RunService = game:GetService("RunService")

Character:WaitForChild("Humanoid").AutoRotate = false

RunService:BindToRenderStep("Camlock", 100, function()
	script.Parent.HumanoidRootPart.CFrame = CFrame.lookAt(script.Parent.HumanoidRootPart.Position, game.Workspace.CurrentCamera.CFrame.Position)
end)

I need the camera to face the back of the head, and to not make the character tilt backward and forward.

Help please!

1 Like

I pretty much wrote this exact same script for someone earlier, here it is.

local run = game:GetService("RunService")

local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")

local camera = workspace.CurrentCamera

run.RenderStepped:Connect(function()
	hrp.CFrame = CFrame.lookAt(hrp.Position, Vector3.new(camera.CFrame.Position.X, hrp.Position.Y, camera.CFrame.Position.Z)) * CFrame.Angles(0, math.rad(180), 0)
end)
1 Like

Thanks so much for the quick help!

1 Like