Humanoid camera offset acts differently in shift lock

I’m using the following script to offset the camera so the character’s head is the subject

game:GetService("RunService"):BindToRenderStep("TrackHead", Enum.RenderPriority.Camera.Value, function()
		Humanoid.CameraOffset = (HumanoidRootPart.CFrame + Vector3.new(0, 1.5, 0)):PointToObjectSpace(Character.Head.Position)
end)

When not in shiftlock, it works as inteneded (Camera is tracking from head):
image

In shiftlock, the offset is completely off, like its tracking from the HumanoidRootPart instead:
image

Is there a way to make it work in shift lock?

4 Likes

The issue you’re facing is due to the way Roblox handles camera control when Shift Lock is enabled. When Shift Lock is on, the camera is controlled by the client, and the server-side script you provided doesn’t have direct control over the camera.

To fix this, you can use a LocalScript to offset the camera on the client-side. Here’s an example:

-- Client-side script (LocalScript)
local Players = game:GetService("Players")
local character = Players.LocalPlayer.Character
local humanoid = character:WaitForChild("Humanoid")
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local head = character:WaitForChild("Head")

local camera = game:GetService("Workspace").CurrentCamera

while wait() do
    local offset = (humanoidRootPart.CFrame + Vector3.new(0, 1.5, 0)):PointToObjectSpace(head.Position)
    camera.CameraOffset = offset
end

-- This script will run on the client-side and update the camera offset accordingly, even when Shift Lock is enabled.

-- Note that you'll need to adjust the script to fit your specific use case, such as handling character changes or other edge cases.

The script I provided is in a LocalScript, the problem still persists in shift lock only.

Hi there, I think I got the solution. I came from @Makaunity 's post

Explanation/Tutorial
  1. Playtest the game, then go to StarterPlayer > StarterPlayerScripts and then copy the PlayerModule

  2. Now exit the playtest session and paste it into StarterPlayer.StarterPlayerScripts

  3. Then open up the BaseCamera script that’s inside of the CameraModule of PlayerModule
    image

  4. After you’ve opened up the script make sure to go to line 393 and add the shouldFollowHead parameter

  5. Now create the if statement on line 439 shown down below. (just copy line 439 and paste it in 442 for the else in the if statement so you don’t have to retype it)

  6. After this leave this script and enter the ClassicCamera script in the CameraModule
    image

  7. Then go to line 124 and pass the value true in the GetSubjectPosition function

  8. Now scroll a little bit down to line 144 and comment everything after RightVector

That’s it, now it should be fixed.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.