So, I’m adding alight-orientation to make my aiming system smoother, because the aiming system is just making you shift lock.
Now, I have 3 main issues.
1. Once I join my player is back pedaling.
2. My player is floating off the ground
3. And finally when I’m in shiftlock and look in any direction it looks like I’m using the fly command from kohls admin.
I don’t know if it’s the script or just the settings from the align orientation itself, also I’m getting no errors, so I’m assuming it has to do with the settings.
Properties
script
local TweeningService = game:GetService("TweenService")
local Player = game:GetService("Players").LocalPlayer
local Character = workspace:WaitForChild(Player.Name)
local Humanoid = Character:WaitForChild("Humanoid")
local RunService = game:GetService("RunService")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart", 5)
local Aim = Vector3.new(2.10, 0.70, 0) -- Field of view when shift lock is enabled
local Nim = Vector3.new(0, 0, 0) -- Default field of view
local RootAttachment = Instance.new("Attachment", HumanoidRootPart)
-- Create a new invisible part to hold the CameraAttachment
local CameraPart = Instance.new("Part")
CameraPart.Anchored = true
CameraPart.CanCollide = false
CameraPart.Transparency = 1
CameraPart.Parent = workspace
local CameraAttachment = Instance.new("Attachment", CameraPart)
local AlignOrientation = Instance.new("AlignOrientation")
AlignOrientation.Attachment0 = RootAttachment
AlignOrientation.Attachment1 = CameraAttachment
AlignOrientation.Enabled = true
AlignOrientation.Parent = HumanoidRootPart
local function Aimming(enabled)
_G.ForceShiftLock = enabled
local fov = enabled and Aim or Nim
local tweenInfo = TweenInfo.new(0.5) -- Duration of the tween
local tween = TweeningService:Create(Humanoid, tweenInfo, {CameraOffset = fov})
tween:Play()
end
local function ShiftLock(Active)
if Active and Humanoid.CameraOffset == Vector3.new(0, 0, 0) then
Aimming(true)
Humanoid.AutoRotate = false -- Disable the automatic rotation since we are the ones setting it.
AlignOrientation.Enabled = true -- Enable AlignOrientation
local function ConnectShiftLock()
local CameraLookVector = workspace.CurrentCamera.CFrame.LookVector
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter -- Set the mouse to center every frame.
-- Position the CameraPart to follow the camera
CameraPart.CFrame = workspace.CurrentCamera.CFrame
-- Update the AlignOrientation CFrame to smoothly follow the camera
AlignOrientation.CFrame = CFrame.lookAt(Vector3.zero, CameraLookVector * Vector3.new(2.10, 0.70, 0))
end
RunService:BindToRenderStep("ShiftLock", Enum.RenderPriority.Character.Value, ConnectShiftLock)
else
Aimming(false) -- Move the camera back to normal.
RunService:UnbindFromRenderStep("ShiftLock") -- Allow mouse to move freely.
UserInputService.MouseBehavior = Enum.MouseBehavior.Default -- Let the mouse move freely
Humanoid.AutoRotate = true -- Let the humanoid handle the camera rotations again.
AlignOrientation.Enabled = false -- Disable AlignOrientation
end
end
wait(5)
ShiftLock(true)
wait(5)
ShiftLock(false)
wait(2)
ShiftLock(true)
wait(2)
ShiftLock(false)```