Guest User

Shiftlock script

a guest
Oct 25th, 2024
3,794
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1.  
  2. --Scripted by FilipFree_Stylee used for bloxystaken video
  3.  
  4. local SHOW_CENTER_CURSOR = true
  5.  
  6. local MOBILE_ENABLED = true
  7. local CONSOLE_ENABLED = true
  8.  
  9. local CONSOLE_BUTTON = Enum.KeyCode.ButtonR2
  10.  
  11. local UserInputService = game:GetService("UserInputService")
  12. local RunService = game:GetService("RunService")
  13. local GuiService = game:GetService("GuiService")
  14.  
  15. local Player = game.Players.LocalPlayer
  16.  
  17. local IsMobile = UserInputService.TouchEnabled
  18. local IsConsole = GuiService:IsTenFootInterface()
  19.  
  20. local UserGameSettings = UserSettings():GetService("UserGameSettings")
  21.  
  22. local offset = CFrame.new(1.75, 0, 0)
  23.  
  24. if (IsMobile and MOBILE_ENABLED) or (IsConsole and CONSOLE_ENABLED) then
  25. local Activated = false
  26.  
  27. local SHIFT_LOCK_OFF = 'rbxasset://textures/ui/mouseLock_off.png'
  28. local SHIFT_LOCK_ON = 'rbxasset://textures/ui/mouseLock_on.png'
  29. local SHIFT_LOCK_CURSOR = 'rbxasset://textures/MouseLockedCursor.png'
  30.  
  31. local middleFrame = Instance.new('Frame')
  32. middleFrame.Name = "MiddleIcon"
  33. middleFrame.Size = UDim2.new(.075, 0, .075, 0)
  34. middleFrame.Position = UDim2.new(.5, 0, .5, 0)
  35. middleFrame.AnchorPoint = Vector2.new(.5,.5)
  36. middleFrame.BackgroundTransparency = 1
  37. middleFrame.ZIndex = 10
  38. middleFrame.Visible = true
  39. middleFrame.Parent = script.Parent
  40.  
  41. local MouseLockCursor = Instance.new('ImageLabel')
  42. MouseLockCursor.Name = "MouseLockLabel"
  43. MouseLockCursor.Size = UDim2.new(1, 0, 1, 0)
  44. MouseLockCursor.Position = UDim2.new(0, 0, 0, 0)
  45. MouseLockCursor.BackgroundTransparency = 1
  46. MouseLockCursor.Image = SHIFT_LOCK_CURSOR
  47. MouseLockCursor.Visible = false
  48. MouseLockCursor.Parent = middleFrame
  49.  
  50. local arc = Instance.new("UIAspectRatioConstraint")
  51. arc.AspectRatio = 1
  52. arc.DominantAxis = "Height"
  53. arc.Parent = middleFrame
  54.  
  55. if IsMobile and MOBILE_ENABLED then
  56.  
  57. local frame = Instance.new('Frame')
  58. frame.Name = "BottomLeftControl"
  59. frame.Size = UDim2.new(.1, 0, .1, 0)
  60. frame.Position = UDim2.new(1, 0, 1, 0)
  61. frame.AnchorPoint = Vector2.new(1,1)
  62. frame.BackgroundTransparency = 1
  63. frame.ZIndex = 10
  64. frame.Parent = script.Parent
  65.  
  66. local ShiftLockIcon = Instance.new('ImageButton')
  67. ShiftLockIcon.Name = "MouseLockLabel"
  68. ShiftLockIcon.Size = UDim2.new(1, 0, 1, 0)
  69. ShiftLockIcon.Position = UDim2.new(-2.775, 0, -1.975, 0)
  70. ShiftLockIcon.BackgroundTransparency = 1
  71. ShiftLockIcon.Image = SHIFT_LOCK_OFF
  72. ShiftLockIcon.Visible = true
  73. ShiftLockIcon.Parent = frame
  74.  
  75. local arc2 = Instance.new("UIAspectRatioConstraint")
  76. arc2.AspectRatio = 1
  77. arc2.DominantAxis = "Height"
  78. arc2.Parent = frame
  79.  
  80. ShiftLockIcon.Activated:connect(function()
  81. Activated = not Activated
  82.  
  83. ShiftLockIcon.Image = Activated and SHIFT_LOCK_ON or SHIFT_LOCK_OFF
  84. MouseLockCursor.Visible = Activated and SHOW_CENTER_CURSOR
  85. end)
  86. end
  87.  
  88. if IsConsole and CONSOLE_ENABLED then
  89. UserInputService.InputBegan:Connect(function(input)
  90. if input.KeyCode == CONSOLE_BUTTON then
  91. Activated = not Activated
  92.  
  93. MouseLockCursor.Visible = Activated and SHOW_CENTER_CURSOR
  94. end
  95. end)
  96. end
  97.  
  98. local function OnStep()
  99. if Activated then
  100. UserGameSettings.RotationType = Enum.RotationType.CameraRelative
  101.  
  102. local Camera = workspace.CurrentCamera
  103. if Camera then
  104.  
  105. if (Camera.Focus.Position - Camera.CFrame.Position).Magnitude >= 0.99 then
  106. Camera.CFrame = Camera.CFrame * offset
  107. Camera.Focus = CFrame.fromMatrix(Camera.Focus.Position, Camera.CFrame.RightVector, Camera.CFrame.UpVector) * offset
  108. end
  109. end
  110. end
  111. end
  112. RunService:BindToRenderStep("Mobile/ConsoleShiftLock",Enum.RenderPriority.Camera.Value+1,OnStep)
  113. end
  114.  
Advertisement
Add Comment
Please, Sign In to add comment