Advertisement
bazilimf

Permanent Shiftlock

Jul 14th, 2023 (edited)
865,378
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. -- Remade by tibe0124
  2. -- Subscribe tibe_D4RK :>
  3.  
  4. local ShiftLockScreenGui = Instance.new("ScreenGui")
  5. local ShiftLockButton = Instance.new("ImageButton")
  6. local ShiftlockCursor = Instance.new("ImageLabel")
  7. local CoreGui = game:GetService("CoreGui")
  8. local Players = game:GetService("Players")
  9. local RunService = game:GetService("RunService")
  10. local ContextActionService = game:GetService("ContextActionService")
  11. local Player = Players.LocalPlayer
  12. local UserInputService = game:GetService("UserInputService")
  13. local States = {
  14. Off = "rbxasset://textures/ui/mouseLock_off@2x.png",
  15. On = "rbxasset://textures/ui/mouseLock_on@2x.png",
  16. Lock = "rbxasset://textures/MouseLockedCursor.png",
  17. Lock2 = "rbxasset://SystemCursors/Cross"
  18. }
  19. local MaxLength = 900000
  20. local EnabledOffset = CFrame.new(1.7, 0, 0)
  21. local DisabledOffset = CFrame.new(-1.7, 0, 0)
  22. local Active
  23.  
  24. ShiftLockScreenGui.Name = "Shiftlock (CoreGui)"
  25. ShiftLockScreenGui.Parent = CoreGui
  26. ShiftLockScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  27. ShiftLockScreenGui.ResetOnSpawn = false
  28.  
  29. ShiftLockButton.Parent = ShiftLockScreenGui
  30. ShiftLockButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  31. ShiftLockButton.BackgroundTransparency = 1.000
  32. ShiftLockButton.Position = UDim2.new(0.7, 0, 0.75, 0)
  33. ShiftLockButton.Size = UDim2.new(0.0636147112, 0, 0.0661305636, 0)
  34. ShiftLockButton.SizeConstraint = Enum.SizeConstraint.RelativeXX
  35. ShiftLockButton.Image = States.Off
  36.  
  37. ShiftlockCursor.Name = "Shiftlock Cursor"
  38. ShiftlockCursor.Parent = ShiftLockScreenGui
  39. ShiftlockCursor.Image = States.Lock
  40. ShiftlockCursor.Size = UDim2.new(0.03, 0, 0.03, 0)
  41. ShiftlockCursor.Position = UDim2.new(0.5, 0, 0.5, 0)
  42. ShiftlockCursor.AnchorPoint = Vector2.new(0.5, 0.5)
  43. ShiftlockCursor.SizeConstraint = Enum.SizeConstraint.RelativeXX
  44. ShiftlockCursor.BackgroundTransparency = 1
  45. ShiftlockCursor.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  46. ShiftlockCursor.Visible = false
  47.  
  48. ShiftLockButton.MouseButton1Click:Connect(
  49. function()
  50. if not Active then
  51. Active =
  52. RunService.RenderStepped:Connect(
  53. function()
  54. Player.Character.Humanoid.AutoRotate = false
  55. ShiftLockButton.Image = States.On
  56. ShiftlockCursor.Visible = true
  57. Player.Character.HumanoidRootPart.CFrame =
  58. CFrame.new(
  59. Player.Character.HumanoidRootPart.Position,
  60. Vector3.new(
  61. workspace.CurrentCamera.CFrame.LookVector.X * MaxLength,
  62. Player.Character.HumanoidRootPart.Position.Y,
  63. workspace.CurrentCamera.CFrame.LookVector.Z * MaxLength
  64. )
  65. )
  66. workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * EnabledOffset
  67. workspace.CurrentCamera.Focus =
  68. CFrame.fromMatrix(
  69. workspace.CurrentCamera.Focus.Position,
  70. workspace.CurrentCamera.CFrame.RightVector,
  71. workspace.CurrentCamera.CFrame.UpVector
  72. ) * EnabledOffset
  73. end
  74. )
  75. else
  76. Player.Character.Humanoid.AutoRotate = true
  77. ShiftLockButton.Image = States.Off
  78. workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * DisabledOffset
  79. ShiftlockCursor.Visible = false
  80. pcall(
  81. function()
  82. Active:Disconnect()
  83. Active = nil
  84. end
  85. )
  86. end
  87. end
  88. )
  89.  
  90. local ShiftLockAction = ContextActionService:BindAction("Shift Lock", ShiftLock, false, "On")
  91. ContextActionService:SetPosition("Shift Lock", UDim2.new(0.8, 0, 0.8, 0))
  92.  
  93. return {} and ShiftLockAction
  94.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement