I’m trying to make custom shift lock and it’s sort of working but I just need to reset the camera after the player hits shift again so that their camera is normal, how would I do that? The character also isn’t facing the camera so I need help fixing that as well
If there’s a better way to do this, please let me know
local CAS = game:GetService('ContextActionService')
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
local runservice
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(3,0,0)
runservice = RS.RenderStepped:Connect(function()
character.PrimaryPart.CFrame = CFrame.new(character.PrimaryPart.CFrame.p + Vector3.new(camera.CFrame.LookVector.X,0,camera.CFrame.LookVector.Z))
end)
elseif input.KeyCode == Enum.KeyCode.LeftShift and shiftlock == true then
shiftlock = not shiftlock
UIS.MouseBehavior = Enum.MouseBehavior.Default
runservice:Disconnect()
--HOW DO YOU RESET THE CAMERA
end
end)