-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoclicker.lua
More file actions
131 lines (115 loc) · 4 KB
/
autoclicker.lua
File metadata and controls
131 lines (115 loc) · 4 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
-- Auto clickdetector clicker made by 3dsj2
if not game:IsLoaded() then
game.Loaded:Wait()
end
game.StarterGui:SetCore("SendNotification", {Title = "Auto Clicker", Text = "Made by 3dsj2", Duration = 2})
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local isEnabled = false
local clickDelay = 0.5
local mainLoopThread = nil
local screenGui = gethui()
local mainFrame = Instance.new("Frame")
mainFrame.Name = "MainFrame"
mainFrame.Size = UDim2.new(0, 200, 0, 130)
mainFrame.Position = UDim2.new(0.5, -100, 0.5, -65)
mainFrame.BackgroundColor3 = Color3.fromRGB(35, 35, 45)
mainFrame.BorderColor3 = Color3.fromRGB(85, 85, 125)
mainFrame.BorderSizePixel = 2
mainFrame.Active = true
mainFrame.Draggable = true
mainFrame.Parent = screenGui
local titleLabel = Instance.new("TextLabel")
titleLabel.Name = "Title"
titleLabel.Size = UDim2.new(1, 0, 0, 25)
titleLabel.BackgroundColor3 = Color3.fromRGB(55, 55, 75)
titleLabel.BorderColor3 = Color3.fromRGB(85, 85, 125)
titleLabel.BorderSizePixel = 2
titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
titleLabel.Text = "Auto Clicker"
titleLabel.Font = Enum.Font.SourceSansBold
titleLabel.TextSize = 16
titleLabel.Parent = mainFrame
local toggleButton = Instance.new("TextButton")
toggleButton.Name = "ToggleButton"
toggleButton.Size = UDim2.new(0, 180, 0, 25)
toggleButton.Position = UDim2.new(0.5, -90, 0, 35)
toggleButton.BackgroundColor3 = Color3.fromRGB(255, 80, 80)
toggleButton.BorderColor3 = Color3.fromRGB(255, 255, 255)
toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
toggleButton.Font = Enum.Font.SourceSansBold
toggleButton.TextSize = 16
toggleButton.Text = "Toggle (Disabled)"
toggleButton.Parent = mainFrame
local delayInput = Instance.new("TextBox")
delayInput.Name = "DelayInput"
delayInput.Size = UDim2.new(0, 180, 0, 25)
delayInput.Position = UDim2.new(0.5, -90, 0, 65)
delayInput.BackgroundColor3 = Color3.fromRGB(25, 25, 35)
delayInput.BorderColor3 = Color3.fromRGB(255, 255, 255)
delayInput.TextColor3 = Color3.fromRGB(255, 255, 255)
delayInput.Text = tostring(clickDelay)
delayInput.Font = Enum.Font.SourceSans
delayInput.TextSize = 14
delayInput.ClearTextOnFocus = false
delayInput.Parent = mainFrame
local closeButton = Instance.new("TextButton")
closeButton.Name = "CloseButton"
closeButton.Size = UDim2.new(0, 180, 0, 25)
closeButton.Position = UDim2.new(0.5, -90, 0, 95)
closeButton.BackgroundColor3 = Color3.fromRGB(150, 40, 40)
closeButton.BorderColor3 = Color3.fromRGB(255, 255, 255)
closeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
closeButton.Font = Enum.Font.SourceSansBold
closeButton.TextSize = 16
closeButton.Text = "Close & Disable"
closeButton.Parent = mainFrame
local function autoClickLoop()
while isEnabled do
pcall(function()
for _, descendant in ipairs(workspace:GetDescendants()) do
if not isEnabled then break end
if descendant:IsA("ClickDetector") then
fireclickdetector(descendant)
task.wait(clickDelay)
end
end
end)
task.wait(1)
end
end
local function stopLoop()
isEnabled = false
if mainLoopThread then
task.cancel(mainLoopThread)
mainLoopThread = nil
end
toggleButton.Text = "Toggle (Disabled)"
toggleButton.BackgroundColor3 = Color3.fromRGB(255, 80, 80)
end
local function startLoop()
isEnabled = true
toggleButton.Text = "Toggle (Enabled)"
toggleButton.BackgroundColor3 = Color3.fromRGB(80, 255, 80)
mainLoopThread = task.spawn(autoClickLoop)
end
toggleButton.MouseButton1Click:Connect(function()
if isEnabled then
stopLoop()
else
startLoop()
end
end)
closeButton.MouseButton1Click:Connect(function()
stopLoop()
mainFrame:Destroy()
end)
delayInput.FocusLost:Connect(function(enterPressed)
if enterPressed then
local newDelay = tonumber(delayInput.Text)
if newDelay and newDelay >= 0 then
clickDelay = newDelay
end
end
delayInput.Text = tostring(clickDelay)
end)