-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutoClickRobloxUniversal
More file actions
85 lines (79 loc) · 2.89 KB
/
Copy pathAutoClickRobloxUniversal
File metadata and controls
85 lines (79 loc) · 2.89 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
74
75
76
77
78
79
80
81
82
83
84
85
getgenv().Settings = {
["Auto Click Keybind"] = "F", -- Use an UpperCase letter or KeyCode Enum. Ex: Enum.KeyCode.Semicolon
["Lock Mouse Position Keybind"] = "F",
["Right Click"] = false,
["GUI"] = true, -- A drawing gui that tells you what is going on with the autoclicker.
["Delay"] = 0 -- 0 for RenderStepped, other numbers go to regular wait timings.
}
--Already Running--
if getgenv()["Already Running"] then return else getgenv()["Already Running"] = "" 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}
--Mouse--
local Mouse = setmetatable({}, {
__index = function(table, index)
return UIS:GetMouseLocation()[index]
end
})
--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 = 18,
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
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--
coroutine.wrap(function()
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
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
wait(Settings.Delay)
end
end
end)()