I want to have a smooth camera that 1. you can manually move with right click and 2. doesn’t break shiftlock. I’m trying to make it follow your body (obviously) with a delay on all axis. something like the elden ring camera movement.
Here’s my code right now:
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local camera = workspace.CurrentCamera
local head = script.Parent:WaitForChild("Head")
local subject = script:WaitForChild("Subject")
subject.Position = head.Position
local WEIGHT = 10
local function updateSubject()
if not Players.LocalPlayer or not Players.LocalPlayer.Character or not Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid") then
return
end
local targetPosition = head.CFrame * CFrame.new(0, 0, 0) -- Adjust the offset as per your need
subject.Position = subject.Position:Lerp(targetPosition.p, 1 / WEIGHT)
camera.CameraSubject = subject
end
RunService:BindToRenderStep("UpdateSubject", Enum.RenderPriority.Camera.Value, updateSubject)
everything works except for shiftlock.
PLEASE HELP, thx.