I am trying to make an over-shoulder camera system, that also makes the player’s character face where they are looking (just like shift-lock). It kinda works but it’s really glitchy and even worse on lower-end devices. Can someone help me stop the glitching?
Script:
local SHIFT = math.rad(270)
local plr = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local run = game:GetService("RunService")
local uis = game:GetService("UserInputService")
plr.CameraMaxZoomDistance = 4
plr.CameraMinZoomDistance = 4
run.RenderStepped:Connect(function()
local character = plr.Character or plr.CharacterAdded:Wait()
character:WaitForChild("Humanoid").CameraOffset = Vector3.new(2, 0.25, 1.5)
local root = character:waitForChild("HumanoidRootPart")
local lookVec = camera.CFrame.lookVector
local angle = -math.atan2(lookVec.Z, lookVec.X) + SHIFT
uis.MouseBehavior = Enum.MouseBehavior.LockCenter
root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0, angle, 0)
end)
The problem is it doesnt make the player’s character face their camera direction. If the script can actually do that then please tell me how to, but if not I’m still stuck on it.