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.
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)