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