-
Notifications
You must be signed in to change notification settings - Fork 0
/
mobile shift lock.lua
86 lines (82 loc) · 3.6 KB
/
mobile shift lock.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
local ShiftLockScreenGui = Instance.new("ScreenGui")
_G.SLB = Instance.new("ImageButton")
local ShiftLockButton = _G.SLB
local ShiftlockCursor = Instance.new("ImageLabel")
local CoreGui = game:GetService("CoreGui")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local ContextActionService = game:GetService("ContextActionService")
local Player = Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local States = {
Off = "rbxasset://textures/ui/[email protected]",
On = "rbxasset://textures/ui/[email protected]",
Lock = "rbxasset://textures/MouseLockedCursor.png",
Lock2 = "rbxasset://SystemCursors/Cross"
}
local MaxLength = 900000
local EnabledOffset = CFrame.new(1.7, 0, 0)
local DisabledOffset = CFrame.new(-1.7, 0, 0)
local Active
ShiftLockScreenGui.Name = "Shiftlock (CoreGui)"
ShiftLockScreenGui.Parent = CoreGui
ShiftLockScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ShiftLockScreenGui.ResetOnSpawn = false
ShiftLockButton.Parent = ShiftLockScreenGui
ShiftLockButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
ShiftLockButton.BackgroundTransparency = 1.000
ShiftLockButton.Position = UDim2.new(0.7, 0, -.035, 0)
ShiftLockButton.Size = UDim2.new(0.005, 0, 0.005, 0)
ShiftLockButton.SizeConstraint = Enum.SizeConstraint.RelativeXX
ShiftLockButton.Image = States.Off
ShiftlockCursor.Name = "Shiftlock Cursor"
ShiftlockCursor.Parent = ShiftLockScreenGui
ShiftlockCursor.Image = States.Lock
ShiftlockCursor.Size = UDim2.new(0.03, 0, 0.03, 0)
ShiftlockCursor.Position = UDim2.new(0.5, 0, 0.5, 0)
ShiftlockCursor.AnchorPoint = Vector2.new(0.5, 0.5)
ShiftlockCursor.SizeConstraint = Enum.SizeConstraint.RelativeXX
ShiftlockCursor.BackgroundTransparency = 1
ShiftlockCursor.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
ShiftlockCursor.Visible = false
ShiftLockButton.MouseButton1Click:Connect(
function()
if not Active then
Active =
RunService.RenderStepped:Connect(
function()
Player.Character.Humanoid.AutoRotate = false
ShiftLockButton.Image = States.On
ShiftlockCursor.Visible = true
Player.Character.HumanoidRootPart.CFrame =
CFrame.new(
Player.Character.HumanoidRootPart.Position,
Vector3.new(
workspace.CurrentCamera.CFrame.LookVector.X * MaxLength,
Player.Character.HumanoidRootPart.Position.Y,
workspace.CurrentCamera.CFrame.LookVector.Z * MaxLength
)
)
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * EnabledOffset
workspace.CurrentCamera.Focus =
CFrame.fromMatrix(
workspace.CurrentCamera.Focus.Position,
workspace.CurrentCamera.CFrame.RightVector,
workspace.CurrentCamera.CFrame.UpVector
) * EnabledOffset
end
)
else
Player.Character.Humanoid.AutoRotate = true
ShiftLockButton.Image = States.Off
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * DisabledOffset
ShiftlockCursor.Visible = false
pcall(
function()
Active:Disconnect()
Active = nil
end
)
end
end
)