rrixh

shiftloxk

Aug 5th, 2023
1,556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.14 KB | None | 0 0
  1. -- Gui to Lua
  2. -- Version: 3.2
  3.  
  4. -- Instances:
  5.  
  6. local ShiftlockStarterGui = Instance.new("ScreenGui")
  7. local ImageButton = Instance.new("ImageButton")
  8.  
  9. --Properties:
  10.  
  11. ShiftlockStarterGui.Name = "Shiftlock (StarterGui)"
  12. ShiftlockStarterGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  13. ShiftlockStarterGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  14.  
  15. ImageButton.Parent = ShiftlockStarterGui
  16. ImageButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  17. ImageButton.BackgroundTransparency = 1.000
  18. ImageButton.Position = UDim2.new(0.921914339, 0, 0.552375436, 0)
  19. ImageButton.Size = UDim2.new(0.0636147112, 0, 0.0661305636, 0)
  20. ImageButton.SizeConstraint = Enum.SizeConstraint.RelativeXX
  21. ImageButton.Image = "http://www.roblox.com/asset/?id=182223762"
  22.  
  23. -- Scripts:
  24.  
  25. local function TLQOYN_fake_script() -- ImageButton.ShiftGUI
  26. local script = Instance.new('LocalScript', ImageButton)
  27.  
  28. local MobileCameraFramework = {}
  29. local players = game:GetService("Players")
  30. local runservice = game:GetService("RunService")
  31. local CAS = game:GetService("ContextActionService")
  32. local player = players.LocalPlayer
  33. local character = player.Character or player.CharacterAdded:Wait()
  34. local root = character:WaitForChild("HumanoidRootPart")
  35. local humanoid = character.Humanoid
  36. local camera = workspace.CurrentCamera
  37. local button = script.Parent
  38.  
  39. --Visiblity
  40. uis = game:GetService("UserInputService")
  41. ismobile = uis.TouchEnabled
  42. button.Visible = ismobile
  43.  
  44. local states = {
  45. OFF = "rbxasset://textures/ui/mouseLock_off@2x.png",
  46. ON = "rbxasset://textures/ui/mouseLock_on@2x.png"
  47. }
  48. local MAX_LENGTH = 900000
  49. local active = false
  50. local ENABLED_OFFSET = CFrame.new(1.7, 0, 0)
  51. local DISABLED_OFFSET = CFrame.new(-1.7, 0, 0)
  52. local function UpdateImage(STATE)
  53. button.Image = states[STATE]
  54. end
  55. local function UpdateAutoRotate(BOOL)
  56. humanoid.AutoRotate = BOOL
  57. end
  58. local function GetUpdatedCameraCFrame(ROOT, CAMERA)
  59. return CFrame.new(root.Position, Vector3.new(CAMERA.CFrame.LookVector.X * MAX_LENGTH, root.Position.Y, CAMERA.CFrame.LookVector.Z * MAX_LENGTH))
  60. end
  61. local function EnableShiftlock()
  62. UpdateAutoRotate(false)
  63. UpdateImage("ON")
  64. root.CFrame = GetUpdatedCameraCFrame(root, camera)
  65. camera.CFrame = camera.CFrame * ENABLED_OFFSET
  66. end
  67. local function DisableShiftlock()
  68. UpdateAutoRotate(true)
  69. UpdateImage("OFF")
  70. camera.CFrame = camera.CFrame * DISABLED_OFFSET
  71. pcall(function()
  72. active:Disconnect()
  73. active = nil
  74. end)
  75. end
  76. UpdateImage("OFF")
  77. active = false
  78. function ShiftLock()
  79. if not active then
  80. active = runservice.RenderStepped:Connect(function()
  81. EnableShiftlock()
  82. end)
  83. else
  84. DisableShiftlock()
  85. end
  86. end
  87. local ShiftLockButton = CAS:BindAction("ShiftLOCK", ShiftLock, false, "On")
  88. CAS:SetPosition("ShiftLOCK", UDim2.new(0.8, 0, 0.8, 0))
  89. button.MouseButton1Click:Connect(function()
  90. if not active then
  91. active = runservice.RenderStepped:Connect(function()
  92. EnableShiftlock()
  93. end)
  94. else
  95. DisableShiftlock()
  96. end
  97. end)
  98. return MobileCameraFramework
  99.  
  100. end
  101. coroutine.wrap(TLQOYN_fake_script)()
  102. local function OMQRQRC_fake_script() -- ShiftlockStarterGui.LocalScript
  103. local script = Instance.new('LocalScript', ShiftlockStarterGui)
  104.  
  105. local Players = game:GetService("Players")
  106. local UserInputService = game:GetService("UserInputService")
  107. local Settings = UserSettings()
  108. local GameSettings = Settings.GameSettings
  109. local ShiftLockController = {}
  110. while not Players.LocalPlayer do
  111. wait()
  112. end
  113. local LocalPlayer = Players.LocalPlayer
  114. local Mouse = LocalPlayer:GetMouse()
  115. local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
  116. local ScreenGui, ShiftLockIcon, InputCn
  117. local IsShiftLockMode = true
  118. local IsShiftLocked = true
  119. local IsActionBound = false
  120. local IsInFirstPerson = false
  121. ShiftLockController.OnShiftLockToggled = Instance.new("BindableEvent")
  122. local function isShiftLockMode()
  123. return LocalPlayer.DevEnableMouseLock and GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch and LocalPlayer.DevComputerMovementMode ~= Enum.DevComputerMovementMode.ClickToMove and GameSettings.ComputerMovementMode ~= Enum.ComputerMovementMode.ClickToMove and LocalPlayer.DevComputerMovementMode ~= Enum.DevComputerMovementMode.Scriptable
  124. end
  125. if not UserInputService.TouchEnabled then
  126. IsShiftLockMode = isShiftLockMode()
  127. end
  128. local function onShiftLockToggled()
  129. IsShiftLocked = not IsShiftLocked
  130. ShiftLockController.OnShiftLockToggled:Fire()
  131. end
  132. local initialize = function()
  133. print("enabled")
  134. end
  135. function ShiftLockController:IsShiftLocked()
  136. return IsShiftLockMode and IsShiftLocked
  137. end
  138. function ShiftLockController:SetIsInFirstPerson(isInFirstPerson)
  139. IsInFirstPerson = isInFirstPerson
  140. end
  141. local function mouseLockSwitchFunc(actionName, inputState, inputObject)
  142. if IsShiftLockMode then
  143. onShiftLockToggled()
  144. end
  145. end
  146. local function disableShiftLock()
  147. if ScreenGui then
  148. ScreenGui.Parent = nil
  149. end
  150. IsShiftLockMode = false
  151. Mouse.Icon = ""
  152. if InputCn then
  153. InputCn:disconnect()
  154. InputCn = nil
  155. end
  156. IsActionBound = false
  157. ShiftLockController.OnShiftLockToggled:Fire()
  158. end
  159. local onShiftInputBegan = function(inputObject, isProcessed)
  160. if isProcessed then
  161. return
  162. end
  163. if inputObject.UserInputType ~= Enum.UserInputType.Keyboard or inputObject.KeyCode == Enum.KeyCode.LeftShift or inputObject.KeyCode == Enum.KeyCode.RightShift then
  164. end
  165. end
  166. local function enableShiftLock()
  167. IsShiftLockMode = isShiftLockMode()
  168. if IsShiftLockMode then
  169. if ScreenGui then
  170. ScreenGui.Parent = PlayerGui
  171. end
  172. if IsShiftLocked then
  173. ShiftLockController.OnShiftLockToggled:Fire()
  174. end
  175. if not IsActionBound then
  176. InputCn = UserInputService.InputBegan:connect(onShiftInputBegan)
  177. IsActionBound = true
  178. end
  179. end
  180. end
  181. GameSettings.Changed:connect(function(property)
  182. if property == "ControlMode" then
  183. if GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch then
  184. enableShiftLock()
  185. else
  186. disableShiftLock()
  187. end
  188. elseif property == "ComputerMovementMode" then
  189. if GameSettings.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove then
  190. disableShiftLock()
  191. else
  192. enableShiftLock()
  193. end
  194. end
  195. end)
  196. LocalPlayer.Changed:connect(function(property)
  197. if property == "DevEnableMouseLock" then
  198. if LocalPlayer.DevEnableMouseLock then
  199. enableShiftLock()
  200. else
  201. disableShiftLock()
  202. end
  203. elseif property == "DevComputerMovementMode" then
  204. if LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.ClickToMove or LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.Scriptable then
  205. disableShiftLock()
  206. else
  207. enableShiftLock()
  208. end
  209. end
  210. end)
  211. LocalPlayer.CharacterAdded:connect(function(character)
  212. if not UserInputService.TouchEnabled then
  213. initialize()
  214. end
  215. end)
  216. if not UserInputService.TouchEnabled then
  217. initialize()
  218. if isShiftLockMode() then
  219. InputCn = UserInputService.InputBegan:connect(onShiftInputBegan)
  220. IsActionBound = true
  221. end
  222. end
  223. enableShiftLock()
  224. return ShiftLockController
  225.  
  226. end
  227. coroutine.wrap(OMQRQRC_fake_script)()
Add Comment
Please, Sign In to add comment