Shiftlock by namsobased
Key RequiredUniversal

Shiftlock by namsobased

Universal Scriptnamsobasednamsobased 626 views 14.5K executesUpdated Jan 20, 2026
Unrated
00
Lua Script•152 lines (3796 chars)
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local ContextActionService = game:GetService("ContextActionService")
local UserInputService = game:GetService("UserInputService")
local StarterGui = game:GetService("StarterGui")

local player = Players.LocalPlayer
local camera = workspace.CurrentCamera

task.spawn(function()
	local userId = Players:GetUserIdFromNameAsync("namsobased")
	local thumbType = Enum.ThumbnailType.HeadShot
	local thumbSize = Enum.ThumbnailSize.Size420x420
	local content = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
	StarterGui:SetCore("SendNotification", {
		Title = "namsobased",
		Text = "✅ Shiftlock!",
		Icon = content,
		Duration = 4
	})
end)

local ShiftlockStarterGui
local ImageButton

local character
local humanoid
local root

local MAX_LENGTH = 900000
local ENABLED_OFFSET = CFrame.new(1.5, 0.75, 0)
local DISABLED_OFFSET = CFrame.new(-1.5, 0, 0)
local active = false
local rootPos = Vector3.new(0,0,0)

local states = {
	OFF = "rbxasset://textures/ui/mouseLock_off@2x.png",
	ON = "rbxasset://textures/ui/mouseLock_on@2x.png"
}

local function UpdatePos()
	if character and humanoid and humanoid.RootPart then
		rootPos = humanoid.RootPart.Position
	end
end

local function UpdateImage(state)
	ImageButton.Image = states[state]
end

local function UpdateAutoRotate(bool)
	if humanoid then
		humanoid.AutoRotate = bool
	end
end

local function GetUpdatedCameraCFrame()
	if camera then
		return CFrame.new(
			rootPos,
			Vector3.new(
				camera.CFrame.LookVector.X * MAX_LENGTH,
				rootPos.Y,
				camera.CFrame.LookVector.Z * MAX_LENGTH
			)
		)
	end
end

local function EnableShiftlock()
	UpdatePos()
	UpdateAutoRotate(false)
	UpdateImage("ON")

	if humanoid and humanoid.RootPart then
		humanoid.RootPart.CFrame = GetUpdatedCameraCFrame()
	end

	if camera then
		camera.CFrame = camera.CFrame * ENABLED_OFFSET
	end
end

local function DisableShiftlock()
	UpdatePos()
	UpdateAutoRotate(true)
	UpdateImage("OFF")

	if camera then
		camera.CFrame = camera.CFrame * DISABLED_OFFSET
	end

	pcall(function()
		active:Disconnect()
		active = nil
	end)
end

local function ToggleShiftlock()
	if not active then
		active = RunService.RenderStepped:Connect(function()
			EnableShiftlock()
		end)
	else
		DisableShiftlock()
	end
end

local function createGUI()
	if player:FindFirstChild("PlayerGui") and player.PlayerGui:FindFirstChild("Shiftlock (StarterGui)") then
		player.PlayerGui["Shiftlock (StarterGui)"]:Destroy()
	end

	ShiftlockStarterGui = Instance.new("ScreenGui")
	ShiftlockStarterGui.Name = "Shiftlock (StarterGui)"
	ShiftlockStarterGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
	ShiftlockStarterGui.ResetOnSpawn = false
	ShiftlockStarterGui.Parent = player:WaitForChild("PlayerGui")

	ImageButton = Instance.new("ImageButton")
	ImageButton.Parent = ShiftlockStarterGui
	ImageButton.Active = true
	ImageButton.Draggable = true
	ImageButton.BackgroundTransparency = 1
	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"

	ImageButton.Visible = UserInputService.TouchEnabled

	UpdateImage("OFF")
	ImageButton.MouseButton1Click:Connect(ToggleShiftlock)

	ContextActionService:BindAction("ShiftLOCK", ToggleShiftlock, false, "On")
	ContextActionService:SetPosition("ShiftLOCK", UDim2.new(0.8, 0, 0.8, 0))
end

local function onCharacterAdded(char)
	character = char
	humanoid = character:WaitForChild("Humanoid")
	root = humanoid.RootPart

	task.wait(0.05)
	createGUI()
end

if player.Character then
	onCharacterAdded(player.Character)
end

player.CharacterAdded:Connect(onCharacterAdded)

Features & Information

shiftlock for mobile!
#shiftlock#mobile

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts