SL

Run Settings
LanguageLua
Language Version
Run Command
-- Mobile Shift Lock Script local ShiftlockStarterGui = Instance.new("ScreenGui") local ImageButton = Instance.new("ImageButton") local ScreenGui = Instance.new("ScreenGui") -- Properties ScreenGui.Parent = game:GetService("CoreGui") ShiftlockStarterGui.Name = "Shiftlock (StarterGui)" ShiftlockStarterGui.Parent = ScreenGui ShiftlockStarterGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling ImageButton.Parent = ShiftlockStarterGui ImageButton.Active = true ImageButton.Draggable = true ImageButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255) ImageButton.BackgroundTransparency = 1.000 ImageButton.Position = UDim2.new(0.921914339, 0, 0.552375436, 0) ImageButton.Size = UDim2.new(0.0636147112, 0, 0.0661305636, 0) ImageButton.SizeConstraint = Enum.SizeConstraint.RelativeXX ImageButton.Image = "http://www.roblox.com/asset/?id=182223762" -- Main Script local players = game:GetService("Players") local runservice = game:GetService("RunService") local CAS = game:GetService("ContextActionService") local player = players.LocalPlayer local button = ImageButton -- Visiblity check for mobile local uis = game:GetService("UserInputService") local ismobile = uis.TouchEnabled button.Visible = ismobile local states = { OFF = "rbxasset://textures/ui/mouseLock_off@2x.png", ON = "rbxasset://textures/ui/mouseLock_on@2x.png" } local MAX_LENGTH = 900000 local active = false local ENABLED_OFFSET = CFrame.new(1.7, 0, 0) local DISABLED_OFFSET = CFrame.new(-1.7, 0, 0) local rootPos = Vector3.new(0, 0, 0) local function UpdateImage(STATE) button.Image = states[STATE] end local function UpdatePos() if player.Character and player.Character:FindFirstChildOfClass("Humanoid") and player.Character:FindFirstChildOfClass("Humanoid").RootPart then rootPos = player.Character:FindFirstChildOfClass("Humanoid").RootPart.Position end end local function UpdateAutoRotate(BOOL) if player.Character and player.Character:FindFirstChildOfClass("Humanoid") then player.Character:FindFirstChildOfClass("Humanoid").AutoRotate = BOOL end end local function GetUpdatedCameraCFrame() if workspace.CurrentCamera then return CFrame.new(rootPos, Vector3.new(workspace.CurrentCamera.CFrame.LookVector.X * MAX_LENGTH, rootPos.Y, workspace.CurrentCamera.CFrame.LookVector.Z * MAX_LENGTH)) end end local function EnableShiftlock() UpdatePos() UpdateAutoRotate(false) UpdateImage("ON") if player.Character and player.Character:FindFirstChildOfClass("Humanoid") and player.Character:FindFirstChildOfClass("Humanoid").RootPart then player.Character:FindFirstChildOfClass("Humanoid").RootPart.CFrame = GetUpdatedCameraCFrame() end if workspace.CurrentCamera then workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * ENABLED_OFFSET end end local function DisableShiftlock() UpdatePos() UpdateAutoRotate(true) UpdateImage("OFF") if workspace.CurrentCamera then workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * DISABLED_OFFSET end if active then active:Disconnect() active = false end end UpdateImage("OFF") local function ShiftLock() if not active then active = runservice.RenderStepped:Connect(function() EnableShiftlock() end) else DisableShiftlock() end end -- Bind the action CAS:BindAction("ShiftLOCK", ShiftLock, false, "On") CAS:SetPosition("ShiftLOCK", UDim2.new(0.8, 0, 0.8, 0)) -- Button click handler button.MouseButton1Click:Connect(function() if not active then active = runservice.RenderStepped:Connect(function() EnableShiftlock() end) else DisableShiftlock() end end) -- Cleanup when player leaves game:GetService("Players").PlayerRemoving:Connect(function(leavingPlayer) if leavingPlayer == player then DisableShiftlock() end end)
Editor Settings
Theme
Key bindings
Full width
Lines