Forcing shift lock

i have this very simple code

Humanoid.CameraOffset = Vector3.new(2, 0, 0)

but the camera is weird when moving

1 Like

This offset will permanently set the itself 2 studs to the right of the character. It never shifts around the character based on rotation of camera. You probably have to utilize RunService and run down some vector math to work out where is exactly to the right of the player from the camera.

Supposedly, the CameraOffset property only aligns to an offset positional value but not rotating it to where the Character is facing at

Possibly what you could do, is create a loop using RunService & setting the Character’s PrimaryPart CFrame to be relative to where the camera is currently looking towards maybe?

--LocalScript inside StarterPlayerScripts
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local RunService = game:GetService("RunService")
local Cam = workspace.CurrentCamera

RunService.RenderStepped:Connect(function()
    Character:SetPrimaryPartCFrame(Cam.CFrame)
end)

Forcing Shift lock and changing the camera offset must to be changed in the default camera scripts.
I changed it myself some months ago to made a third person shooter game.

Here is the folder: Camera lock.rbxl (144,9 Ko)

To change the camera offset, open the “CameraModule” script and go to the line 546 - 547

self.activeCameraController:SetIsMouseLocked(true) --Force Shift Lock
self.activeCameraController:SetMouseLockOffset(Vector3.new(2, 0.25, 0)) --Change Camera Offset

Capture1

If you simply want to change the camera offset when you shift to lock, you can disable the forcing shift lock

self.activeCameraController:SetIsMouseLocked(false)

Change the keybind and camera offset for the normal shift lock
Capture3

Hope this help !

1 Like

try this

local camera = workspace.CurrentCamera

Humanoid.CameraOffset = Vector3.new(camera)

That’ll just get the Instance of the Camera, which is an invalid argument for the CameraOffset property since it’s supposed to take a Vector3 value