Camera Offset in terms of Camera?

Hi guys, I’m making a script that’s supposed to set the humanoid offset to make the camera always be offset to the right. I’ve got a script that has the effect I’m after, but I really need it done by using humanoid offset (not pure CFrame.) This is because I want to add mobile and console support, which might be a problem trying to receive controller/screen inputs with my old script. Here’s what I’ve got:

-------------
--- INDEX ---
-------------

--Services
local userInputService = game:GetService("UserInputService")
local runService = game:GetService("RunService")

--Player & Character
local localPlayer = game:GetService("Players").LocalPlayer
local Mouse = localPlayer:GetMouse()

--Other
local Camera = game:GetService("Workspace").CurrentCamera
local ZoomValuePointer = game.ReplicatedFirst.CameraSettings.Zoom

--------------
--- VALUES ---
--------------

local xAngle = 0
local yAngle = 0
--local cameraPos = Vector3.new(3.5,0,10)
--===============ABOVE LINE MOVED INTO THE RENDERSTEPPED FUNCTION.====================--
----------------------
--- INITIALIZATION ---
----------------------

wait(1)
--Camera.CameraType = Enum.CameraType.Scriptable
--userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter

-----------------
--- FUNCTIONS ---
-----------------

userInputService.InputChanged:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseMovement then
		xAngle = xAngle-input.Delta.x*0.4
		--Clamp the vertical axis so it doesn't go upside down or glitch.
		yAngle = math.clamp(yAngle-input.Delta.y*0.4,-80,80)
		end
end)

Mouse.WheelForward:Connect(function()
	ZoomValuePointer.Value = ZoomValuePointer.Value - 1
end)
Mouse.WheelBackward:Connect(function()
	ZoomValuePointer.Value = ZoomValuePointer.Value + 1
end)


runService.RenderStepped:Connect(function()
	local cameraPos = Vector3.new(3.5,0,ZoomValuePointer.Value)
	local Character = localPlayer.Character
	local rootPart = Character:FindFirstChild("HumanoidRootPart")
	if Character and rootPart then
		--Set rotated start cframe inside head
		local startCFrame = CFrame.new((rootPart.CFrame.p + Vector3.new(0,2,0)))*CFrame.Angles(0, math.rad(xAngle), 0)*CFrame.Angles(math.rad(yAngle), 0, 0)
		
		--Set camera focus and cframe
		local cameraCFrame = startCFrame + startCFrame:vectorToWorldSpace(Vector3.new(cameraPos.X,cameraPos.Y,cameraPos.Z))
		local cameraFocus = startCFrame + startCFrame:vectorToWorldSpace(Vector3.new(cameraPos.X,cameraPos.Y,-50000))
		
		Camera.CFrame = CFrame.new(cameraCFrame.p,cameraFocus.p)
	end
end)

I have no idea how to handle controller thumbstick inputs, and I’m just starting out with camera scripting at all. I’ve basically got no idea what I’ve doing here. Here’s my code:

--bigcrazycarboy
hum = script.Parent:WaitForChild("Humanoid")

rs = game:GetService("RunService")

Head = script.Parent:WaitForChild("Head")

rs.RenderStepped:connect(function()
	
	--wait()
	local cameraPos = Vector3.new(3.5,0,0)	
	
	local Cam = game.Workspace.CurrentCamera
	
	
	hum.CameraOffset = Vector3.new(cameraPos.X * Head.CFrame.lookVector.X * Cam.CFrame.lookVector.X, 0, cameraPos.X*Head.CFrame.lookVector.Z * Cam.CFrame.lookVector.X)--+Head.CFrame.lookVector.X * Cam.CFrame.lookVector.Z--[[*Cam.CFrame.lookVector.Z]])
	--hum.CameraOffset.Z = 2*Head.CFrame.lookVector.Z
	
end)

Maybe someone can give me a hand. Thanks,
-big