Free to remix for the script! Or just grab it from here-
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local root = hum.RootPart -- The HumanoidRootPart
local shiftLockEnabled = false
-- Function to toggle shift lock
local function shiftLock(active)
if active then
hum.CameraOffset = Vector3.new(0, 0, 0)
hum.AutoRotate = false
RunService:BindToRenderStep("ShiftLock", Enum.RenderPriority.Character.Value, function()
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ()
root.CFrame = CFrame.new(root.Position) * CFrame.Angles(0, y, 0)
end)
else
hum.CameraOffset = Vector3.new(0, 0, 0)
RunService:UnbindFromRe