-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuwudragtoggle.lua
More file actions
57 lines (52 loc) · 1.91 KB
/
uwudragtoggle.lua
File metadata and controls
57 lines (52 loc) · 1.91 KB
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
local ScreenGui = Instance.new("ScreenGui")
local ImageButton = Instance.new("ImageButton")
local UICorner = Instance.new("UICorner")
ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
ImageButton.Parent = ScreenGui
ImageButton.BackgroundColor3 = Color3.new(0.0705882, 0.0705882, 0.0705882)
ImageButton.BorderColor3 = Color3.new(0.105882, 0.164706, 0.207843)
ImageButton.Position = UDim2.new(0.0602409616, 0, 0.257668734, 0)
ImageButton.Size = UDim2.new(0, 67, 0, 67)
ImageButton.Image = "rbxassetid://7497934730"
UICorner.Parent = ImageButton
UICorner.CornerRadius = UDim.new(1, 1)
ImageButton.MouseButton1Click:Connect(function()
keypress(0xA1)
keyrelease(0xA1)
end)
local function drag()
local script = Instance.new('LocalScript', ImageButton)
local UIS = game:GetService('UserInputService')
local frame = script.Parent
local dragToggle = nil
local dragSpeed = 0.25
local dragStart = nil
local startPos = nil
local function updateInput(input)
local delta = input.Position - dragStart
local position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X,
startPos.Y.Scale, startPos.Y.Offset + delta.Y)
game:GetService('TweenService'):Create(frame, TweenInfo.new(dragSpeed), {Position = position}):Play()
end
frame.InputBegan:Connect(function(input)
if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
dragToggle = true
dragStart = input.Position
startPos = frame.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragToggle = false
end
end)
end
end)
UIS.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
if dragToggle then
updateInput(input)
end
end
end)
end
coroutine.wrap(drag)()