Help with camera 2

How do I make the camera always to go the right side of the character no matter what direction they’re facing?

My version:

What I want:

This is my code:

local UIS = game:GetService('UserInputService')
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild('Humanoid')
local RS = game:GetService('RunService')

local shiftlock = false

UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift and shiftlock == false then
shiftlock = not shiftlock
UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
humanoid.CameraOffset = humanoid.CameraOffset + Vector3.new(2.2,0,0)
elseif input.KeyCode == Enum.KeyCode.LeftShift and shiftlock == true then
shiftlock = not shiftlock
UIS.MouseBehavior = Enum.MouseBehavior.Default
humanoid.CameraOffset = humanoid.CameraOffset - Vector3.new(2.2,0,0)
camera.CameraType = Enum.CameraType.Custom
UserSettings().GameSettings.RotationType = Enum.RotationType.MovementRelative
end
end)

I threw it together so if there’s a better way to do this please let me know

1 Like

The CameraOffset is causing the issue. Perhaps you should just create an invisible part to the right of the head, set it as the CameraSubject, then rotate the part with the camera, ensuring it is to the right of the head? Just a thought.

I think I’d still have the same issue if I did that. The problem is that I want the character to always be to the left of the mouse/camera but I when I move the camera in front of the character, the character moves to the right