R

Shiftloxk

public
rrixh Jul 24, 2024 Never 25
Clone
Bash permSLoxk.xlsx 151 lines (135 loc) | 5.72 KB
1
-- Modified by Guesttester_1
2
-- Remade by tibe0124
3
-- Subscribe tibe_D4RK :>
4
5
-- Dragging Script
6
7
local UserInputService = game:GetService("UserInputService")
8
local TweenService = game:GetService("TweenService")
9
10
local function MakeDraggable(topbarobject, object)
11
local Dragging = nil
12
local DragInput = nil
13
local DragStart = nil
14
local StartPosition = nil
15
16
local function Update(input)
17
local Delta = input.Position - DragStart
18
local pos = UDim2.new(StartPosition.X.Scale, StartPosition.X.Offset + Delta.X, StartPosition.Y.Scale, StartPosition.Y.Offset + Delta.Y)
19
local Tween = TweenService:Create(object, TweenInfo.new(0.15), {
20
Position = pos
21
})
22
Tween:Play()
23
end
24
25
topbarobject.InputBegan:Connect(
26
function(input)
27
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
28
Dragging = true
29
DragStart = input.Position
30
StartPosition = object.Position
31
32
input.Changed:Connect(
33
function()
34
if input.UserInputState == Enum.UserInputState.End then
35
Dragging = false
36
end
37
end
38
)
39
end
40
end
41
)
42
43
topbarobject.InputChanged:Connect(
44
function(input)
45
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
46
DragInput = input
47
end
48
end
49
)
50
51
UserInputService.InputChanged:Connect(
52
function(input)
53
if input == DragInput and Dragging then
54
Update(input)
55
end
56
end
57
)
58
end
59
60
local ShiftLockScreenGui = Instance.new("ScreenGui")
61
local ShiftLockButton = Instance.new("ImageButton")
62
local ShiftlockCursor = Instance.new("ImageLabel")
63
local CoreGui = game:GetService("CoreGui")
64
local Players = game:GetService("Players")
65
local RunService = game:GetService("RunService")
66
local ContextActionService = game:GetService("ContextActionService")
67
local Player = Players.LocalPlayer
68
local UserInputService = game:GetService("UserInputService")
69
local States = {
70
Off = "rbxasset://textures/ui/[email protected]",
71
On = "rbxasset://textures/ui/[email protected]",
72
Lock = "rbxasset://textures/MouseLockedCursor.png",
73
Lock2 = "rbxasset://SystemCursors/Cross"
74
}
75
local MaxLength = 900000
76
local EnabledOffset = CFrame.new(1.7, 0, 0)
77
local DisabledOffset = CFrame.new(-1.7, 0, 0)
78
local Active
79
80
ShiftLockScreenGui.Name = "Shiftlock (CoreGui)"
81
ShiftLockScreenGui.Parent = CoreGui
82
ShiftLockScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
83
ShiftLockScreenGui.ResetOnSpawn = false
84
85
ShiftLockButton.Parent = ShiftLockScreenGui
86
ShiftLockButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
87
ShiftLockButton.BackgroundTransparency = 1.000
88
ShiftLockButton.Position = UDim2.new(0.7, 0, 0.75, 0)
89
ShiftLockButton.Size = UDim2.new(0.0636147112, 0, 0.0661305636, 0)
90
ShiftLockButton.SizeConstraint = Enum.SizeConstraint.RelativeXX
91
ShiftLockButton.Image = States.Off
92
93
ShiftlockCursor.Name = "Shiftlock Cursor"
94
ShiftlockCursor.Parent = ShiftLockScreenGui
95
ShiftlockCursor.Image = States.Lock
96
ShiftlockCursor.Size = UDim2.new(0.03, 0, 0.03, 0)
97
ShiftlockCursor.Position = UDim2.new(0.5, 0, 0.5, 0)
98
ShiftlockCursor.AnchorPoint = Vector2.new(0.5, 0.5)
99
ShiftlockCursor.SizeConstraint = Enum.SizeConstraint.RelativeXX
100
ShiftlockCursor.BackgroundTransparency = 1
101
ShiftlockCursor.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
102
ShiftlockCursor.Visible = false
103
104
MakeDraggable(ShiftLockButton, ShiftLockButton) -- Making the button draggable
105
106
ShiftLockButton.MouseButton1Click:Connect(
107
function()
108
if not Active then
109
Active =
110
RunService.RenderStepped:Connect(
111
function()
112
Player.Character.Humanoid.AutoRotate = false
113
ShiftLockButton.Image = States.On
114
ShiftlockCursor.Visible = true
115
Player.Character.HumanoidRootPart.CFrame =
116
CFrame.new(
117
Player.Character.HumanoidRootPart.Position,
118
Vector3.new(
119
workspace.CurrentCamera.CFrame.LookVector.X * MaxLength,
120
Player.Character.HumanoidRootPart.Position.Y,
121
workspace.CurrentCamera.CFrame.LookVector.Z * MaxLength
122
)
123
)
124
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * EnabledOffset
125
workspace.CurrentCamera.Focus =
126
CFrame.fromMatrix(
127
workspace.CurrentCamera.Focus.Position,
128
workspace.CurrentCamera.CFrame.RightVector,
129
workspace.CurrentCamera.CFrame.UpVector
130
) * EnabledOffset
131
end
132
)
133
else
134
Player.Character.Humanoid.AutoRotate = true
135
ShiftLockButton.Image = States.Off
136
workspace.CurrentCamera.CFrame = workspace.CurrentCamera.CFrame * DisabledOffset
137
ShiftlockCursor.Visible = false
138
pcall(
139
function()
140
Active:Disconnect()
141
Active = nil
142
end
143
)
144
end
145
end
146
)
147
148
local ShiftLockAction = ContextActionService:BindAction("Shift Lock", ShiftLock, false, "On")
149
ContextActionService:SetPosition("Shift Lock", UDim2.new(0.8, 0, 0.8, 0))
150
151
return {} and ShiftLockAction