Repository navigation
Expand file tree
/
Copy pathAutoClicker.lua
More file actions
73 lines (67 loc) · 2.31 KB
/
Copy pathAutoClicker.lua
File metadata and controls
73 lines (67 loc) · 2.31 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--Already Running--
if getgenv()["Already Running"] then return else getgenv()["Already Running"] = true end
--Services--
local UIS = game:GetService("UserInputService")
local VIM = game:GetService("VirtualInputManager")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
--Vars--
local LocalPlayer = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local flags = {Auto_Clicking = false, Mouse_Locked = false}
local TaskWait = task.wait
--Get Keybind--
local getKeycode = function(bind)
return (pcall(function() return Enum.KeyCode[bind] end) and Enum.KeyCode[bind] or bind)
end
--Draw--
local Draw = function(obj, props)
local NewObj = Drawing.new(obj)
for i, v in next, props do
NewObj[i] = v
end
return NewObj
end
--Create GUI--
local Text = Draw("Text", {
Size = 15,
Outline = true,
OutlineColor = Color3.fromRGB(255, 255, 255),
Color = Color3.fromRGB(0, 0, 0),
Text = "Auto Clicking : FALSE\nMouse Locked : FALSE",
Visible = true,
})
--Key Bind--
UIS.InputBegan:Connect(function(inputObj, GPE)
if (not GPE) then
if (inputObj.KeyCode == getKeycode(Settings["Auto Click Keybind"])) then
flags.Auto_Clicking = not flags.Auto_Clicking
end
if (inputObj.KeyCode == getKeycode(Settings["Lock Mouse Position Keybind"])) then
local Mouse = UIS:GetMouseLocation()
flags.Mouse_Locked_Position = Vector2.new(Mouse.X, Mouse.Y)
flags.Mouse_Locked = not flags.Mouse_Locked
end
Text.Text = ("Auto Clicking : %s\nMouse Locked : %s"):format(tostring(flags.Auto_Clicking):upper(), tostring(flags.Mouse_Locked):upper())
end
end)
--Auto Click--
while (true) do
Text.Visible = Settings.GUI
Text.Position = Vector2.new(Camera.ViewportSize.X - 133, Camera.ViewportSize.Y - 48)
if (flags.Auto_Clicking) then
for i = 1, 2 do
if (flags.Mouse_Locked) then
VIM:SendMouseButtonEvent(flags.Mouse_Locked_Position.X, flags.Mouse_Locked_Position.Y, Settings["Right Click"] and 1 or 0, i == 1, nil, 0)
else
local Mouse = UIS:GetMouseLocation()
VIM:SendMouseButtonEvent(Mouse.X, Mouse.Y, Settings["Right Click"] and 1 or 0, i == 1, nil, 0)
end
end
end
if (Settings.Delay <= 0) then
RunService.RenderStepped:Wait()
else
TaskWait(Settings.Delay)
end
end