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