How to set Camera Offset

I have a script that forces custom shiftlock. It works perfectly fine. But i can’t seem to figure out how to offset the camera. I want it to be a bit above and to the right of player’s shoulder (The game is 3-rd person)

hum.CameraOffset line seems to do nothing, no matter what values i give it.

How to offset the camera in this script?

local plr = game:GetService("Players").LocalPlayer
local mouse = plr:GetMouse()
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
---------------------------------------------------------
local rotation = char:WaitForChild("HumanoidRootPart"):WaitForChild("BodyGyro") --Create a new body gyro.
--rotation.P = 1000000 --Increase the power
--rotation.Parent = hum.RootPart --Parent it to the HumanoidRootPart
---------------------------------------------------------
local conn -- connection variable

function shiftLock(active) --Toggle shift.lock function
	if active then
		hum.CameraOffset = Vector3.new(2,1,0) -- I assume this is about the right camera offset.
		---------------------------------------------------------
		rotation.MaxTorque = Vector3.new(0, math.huge, 0) --Max the power on the Y axis
		---------------------------------------------------------
		conn = game:GetService("RunService").RenderStepped:Connect(function()
			rotation.CFrame = mouse.Origin
			game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter
		end) --Set the mouse to center every frame.
	else
		hum.CameraOffset = Vector3.new(0,0,0) --Move the camera back to normal.
		---------------------------------------------------------
		rotation.MaxTorque = Vector3.new(0, 0, 0) --Clear the torque on the HumanoidRootPart
		---------------------------------------------------------
		if conn then conn:Disconnect() end -- Allow mouse to move freely.
	end
end
2 Likes

can i get a video of problem? cuz i tested it, it work for me (yes i mean camera offset)

2 Likes

I have no idea what changed, but the offset didnt work yesterday. I posted this today without testing, cuz i wanted to focus on other aspects of game while good people are trying to figure the solution out on the devforum, to not lose time.

Anyway, marking as solution cuz i just tested this and this works perfect xDDD

1 Like

I 've ran into another issue, can you please look at my other post?

ye i see that i am trying to find way right now without using outdated method

1 Like

welp it look like i am a bit late someone already reply when i finished dinner anyway that answer should work so try it

1 Like

It worked, thank you both! :smiley:

charrr

1 Like