Mr_3242

Auto clicker

Mar 30th, 2026 (edited)
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.12 KB | Gaming | 0 0
  1. -- Advanced Auto Clicker with Multiple Click Zones
  2. -- Compatible with PC and Mobile
  3.  
  4. local Players = game:GetService("Players")
  5. local TweenService = game:GetService("TweenService")
  6. local UserInputService = game:GetService("UserInputService")
  7. local RunService = game:GetService("RunService")
  8.  
  9. local player = Players.LocalPlayer
  10. local playerGui = player:WaitForChild("PlayerGui")
  11. local mouse = player:GetMouse()
  12.  
  13. -- Theme
  14. local theme = {
  15.     primary = Color3.fromRGB(100, 100, 255),
  16.     secondary = Color3.fromRGB(80, 80, 200),
  17.     background = Color3.fromRGB(15, 15, 20),
  18.     surface = Color3.fromRGB(25, 25, 35),
  19.     text = Color3.fromRGB(255, 255, 255),
  20.     textSecondary = Color3.fromRGB(180, 180, 200),
  21.     success = Color3.fromRGB(50, 200, 100),
  22.     error = Color3.fromRGB(255, 80, 80),
  23.     warning = Color3.fromRGB(255, 180, 50)
  24. }
  25.  
  26. -- Configuration
  27. local LOGO_ASSET_ID = "rbxassetid://109421193232034"
  28. local clickZones = {}
  29. local autoClickerEnabled = false
  30. local currentSpeed = 0.1 -- Default 10 clicks per second
  31. local speedPresets = {
  32.     {name = "Slow (5/s)", speed = 0.2},
  33.     {name = "Normal (10/s)", speed = 0.1},
  34.     {name = "Fast (20/s)", speed = 0.05},
  35.     {name = "Very Fast (50/s)", speed = 0.02},
  36.     {name = "Ultra (100/s)", speed = 0.01}
  37. }
  38. local selectedSpeedIndex = 2
  39.  
  40. -- Create GUI
  41. local screenGui = Instance.new("ScreenGui")
  42. screenGui.Name = "AutoClickerGUI"
  43. screenGui.ResetOnSpawn = false
  44. screenGui.IgnoreGuiInset = true
  45. screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  46. screenGui.Parent = playerGui
  47.  
  48. -- Main Frame
  49. local mainFrame = Instance.new("Frame")
  50. mainFrame.Name = "MainFrame"
  51. mainFrame.Size = UDim2.new(0, 350, 0, 450)
  52. mainFrame.Position = UDim2.new(0, 20, 0.5, -225)
  53. mainFrame.BackgroundColor3 = theme.background
  54. mainFrame.BorderSizePixel = 0
  55. mainFrame.Parent = screenGui
  56.  
  57. local mainCorner = Instance.new("UICorner")
  58. mainCorner.CornerRadius = UDim.new(0, 12)
  59. mainCorner.Parent = mainFrame
  60.  
  61. -- Make draggable
  62. local dragging = false
  63. local dragInput, dragStart, startPos
  64.  
  65. local function update(input)
  66.     local delta = input.Position - dragStart
  67.     mainFrame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  68. end
  69.  
  70. mainFrame.InputBegan:Connect(function(input)
  71.     if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  72.         dragging = true
  73.         dragStart = input.Position
  74.         startPos = mainFrame.Position
  75.        
  76.         input.Changed:Connect(function()
  77.             if input.UserInputState == Enum.UserInputState.End then
  78.                 dragging = false
  79.             end
  80.         end)
  81.     end
  82. end)
  83.  
  84. mainFrame.InputChanged:Connect(function(input)
  85.     if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  86.         dragInput = input
  87.     end
  88. end)
  89.  
  90. UserInputService.InputChanged:Connect(function(input)
  91.     if input == dragInput and dragging then
  92.         update(input)
  93.     end
  94. end)
  95.  
  96. -- Header
  97. local header = Instance.new("Frame")
  98. header.Name = "Header"
  99. header.Size = UDim2.new(1, 0, 0, 70)
  100. header.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  101. header.BorderSizePixel = 0
  102. header.Parent = mainFrame
  103.  
  104. local headerCorner = Instance.new("UICorner")
  105. headerCorner.CornerRadius = UDim.new(0, 12)
  106. headerCorner.Parent = header
  107.  
  108. local headerFix = Instance.new("Frame")
  109. headerFix.Size = UDim2.new(1, 0, 0, 12)
  110. headerFix.Position = UDim2.new(0, 0, 1, -12)
  111. headerFix.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  112. headerFix.BorderSizePixel = 0
  113. headerFix.Parent = header
  114.  
  115. -- Logo Frame
  116. local logoFrame = Instance.new("Frame")
  117. logoFrame.Name = "LogoFrame"
  118. logoFrame.Size = UDim2.new(0, 55, 0, 55)
  119. logoFrame.Position = UDim2.new(0, 10, 0.5, -27.5)
  120. logoFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  121. logoFrame.BorderSizePixel = 0
  122. logoFrame.Parent = header
  123.  
  124. local logoCorner = Instance.new("UICorner")
  125. logoCorner.CornerRadius = UDim.new(0, 10)
  126. logoCorner.Parent = logoFrame
  127.  
  128. local logoImage = Instance.new("ImageLabel")
  129. logoImage.Name = "LogoImage"
  130. logoImage.Size = UDim2.new(1, -8, 1, -8)
  131. logoImage.Position = UDim2.new(0, 4, 0, 4)
  132. logoImage.BackgroundTransparency = 1
  133. logoImage.Image = LOGO_ASSET_ID
  134. logoImage.ScaleType = Enum.ScaleType.Fit
  135. logoImage.Parent = logoFrame
  136.  
  137. -- Title
  138. local titleLabel = Instance.new("TextLabel")
  139. titleLabel.Size = UDim2.new(1, -180, 1, 0)
  140. titleLabel.Position = UDim2.new(0, 75, 0, 0)
  141. titleLabel.BackgroundTransparency = 1
  142. titleLabel.Text = "MOLYN AUTO CLICKER"
  143. titleLabel.TextColor3 = theme.text
  144. titleLabel.TextSize = 20
  145. titleLabel.TextXAlignment = Enum.TextXAlignment.Left
  146. titleLabel.Font = Enum.Font.GothamBold
  147. titleLabel.Parent = header
  148.  
  149. -- Close Button
  150. local closeButton = Instance.new("TextButton")
  151. closeButton.Size = UDim2.new(0, 40, 0, 40)
  152. closeButton.Position = UDim2.new(1, -50, 0.5, -20)
  153. closeButton.BackgroundColor3 = theme.error
  154. closeButton.Text = "✕"
  155. closeButton.TextColor3 = theme.text
  156. closeButton.TextSize = 20
  157. closeButton.Font = Enum.Font.GothamBold
  158. closeButton.BorderSizePixel = 0
  159. closeButton.Parent = header
  160.  
  161. local closeCorner = Instance.new("UICorner")
  162. closeCorner.CornerRadius = UDim.new(0, 8)
  163. closeCorner.Parent = closeButton
  164.  
  165. -- Content
  166. local content = Instance.new("Frame")
  167. content.Name = "Content"
  168. content.Size = UDim2.new(1, -30, 1, -90)
  169. content.Position = UDim2.new(0, 15, 0, 80)
  170. content.BackgroundTransparency = 1
  171. content.Parent = mainFrame
  172.  
  173. -- Status Label
  174. local statusLabel = Instance.new("TextLabel")
  175. statusLabel.Size = UDim2.new(1, 0, 0, 30)
  176. statusLabel.Position = UDim2.new(0, 0, 0, 0)
  177. statusLabel.BackgroundTransparency = 1
  178. statusLabel.Text = "⏸️ Status: Disabled"
  179. statusLabel.TextColor3 = theme.textSecondary
  180. statusLabel.TextSize = 16
  181. statusLabel.TextXAlignment = Enum.TextXAlignment.Left
  182. statusLabel.Font = Enum.Font.GothamBold
  183. statusLabel.Parent = content
  184.  
  185. -- Toggle Button
  186. local toggleButton = Instance.new("TextButton")
  187. toggleButton.Size = UDim2.new(1, 0, 0, 50)
  188. toggleButton.Position = UDim2.new(0, 0, 0, 35)
  189. toggleButton.BackgroundColor3 = theme.success
  190. toggleButton.Text = "▶️ START AUTO CLICKER"
  191. toggleButton.TextColor3 = theme.text
  192. toggleButton.TextSize = 16
  193. toggleButton.Font = Enum.Font.GothamBold
  194. toggleButton.BorderSizePixel = 0
  195. toggleButton.Parent = content
  196.  
  197. local toggleCorner = Instance.new("UICorner")
  198. toggleCorner.CornerRadius = UDim.new(0, 10)
  199. toggleCorner.Parent = toggleButton
  200.  
  201. -- Speed Label
  202. local speedLabel = Instance.new("TextLabel")
  203. speedLabel.Size = UDim2.new(1, 0, 0, 25)
  204. speedLabel.Position = UDim2.new(0, 0, 0, 95)
  205. speedLabel.BackgroundTransparency = 1
  206. speedLabel.Text = "⚡ Speed: Normal (10/s)"
  207. speedLabel.TextColor3 = theme.text
  208. speedLabel.TextSize = 14
  209. speedLabel.TextXAlignment = Enum.TextXAlignment.Left
  210. speedLabel.Font = Enum.Font.GothamBold
  211. speedLabel.Parent = content
  212.  
  213. -- Speed Buttons Container
  214. local speedContainer = Instance.new("Frame")
  215. speedContainer.Size = UDim2.new(1, 0, 0, 100)
  216. speedContainer.Position = UDim2.new(0, 0, 0, 125)
  217. speedContainer.BackgroundTransparency = 1
  218. speedContainer.Parent = content
  219.  
  220. -- Create Speed Buttons
  221. local speedButtons = {}
  222. for i, preset in ipairs(speedPresets) do
  223.     local btn = Instance.new("TextButton")
  224.     btn.Size = UDim2.new(0.48, -5, 0, 30)
  225.    
  226.     -- Position in grid (2 columns)
  227.     if i % 2 == 1 then
  228.         btn.Position = UDim2.new(0, 0, 0, math.floor((i-1)/2) * 35)
  229.     else
  230.         btn.Position = UDim2.new(0.52, 0, 0, math.floor((i-1)/2) * 35)
  231.     end
  232.    
  233.     btn.BackgroundColor3 = i == selectedSpeedIndex and theme.primary or theme.surface
  234.     btn.Text = preset.name
  235.     btn.TextColor3 = theme.text
  236.     btn.TextSize = 12
  237.     btn.Font = Enum.Font.Gotham
  238.     btn.BorderSizePixel = 0
  239.     btn.Parent = speedContainer
  240.    
  241.     local btnCorner = Instance.new("UICorner")
  242.     btnCorner.CornerRadius = UDim.new(0, 8)
  243.     btnCorner.Parent = btn
  244.    
  245.     speedButtons[i] = btn
  246. end
  247.  
  248. -- Click Zones Label
  249. local zonesLabel = Instance.new("TextLabel")
  250. zonesLabel.Size = UDim2.new(1, 0, 0, 25)
  251. zonesLabel.Position = UDim2.new(0, 0, 0, 235)
  252. zonesLabel.BackgroundTransparency = 1
  253. zonesLabel.Text = "🎯 Click Zones: 0"
  254. zonesLabel.TextColor3 = theme.text
  255. zonesLabel.TextSize = 14
  256. zonesLabel.TextXAlignment = Enum.TextXAlignment.Left
  257. zonesLabel.Font = Enum.Font.GothamBold
  258. zonesLabel.Parent = content
  259.  
  260. -- Add Zone Button
  261. local addZoneButton = Instance.new("TextButton")
  262. addZoneButton.Size = UDim2.new(1, 0, 0, 45)
  263. addZoneButton.Position = UDim2.new(0, 0, 0, 265)
  264. addZoneButton.BackgroundColor3 = theme.primary
  265. addZoneButton.Text = "➕ ADD CLICK ZONE"
  266. addZoneButton.TextColor3 = theme.text
  267. addZoneButton.TextSize = 15
  268. addZoneButton.Font = Enum.Font.GothamBold
  269. addZoneButton.BorderSizePixel = 0
  270. addZoneButton.Parent = content
  271.  
  272. local addZoneCorner = Instance.new("UICorner")
  273. addZoneCorner.CornerRadius = UDim.new(0, 10)
  274. addZoneCorner.Parent = addZoneButton
  275.  
  276. -- Clear Zones Button
  277. local clearZonesButton = Instance.new("TextButton")
  278. clearZonesButton.Size = UDim2.new(1, 0, 0, 45)
  279. clearZonesButton.Position = UDim2.new(0, 0, 0, 315)
  280. clearZonesButton.BackgroundColor3 = theme.error
  281. clearZonesButton.Text = "🗑️ CLEAR ALL ZONES"
  282. clearZonesButton.TextColor3 = theme.text
  283. clearZonesButton.TextSize = 15
  284. clearZonesButton.Font = Enum.Font.GothamBold
  285. clearZonesButton.BorderSizePixel = 0
  286. clearZonesButton.Parent = content
  287.  
  288. local clearZonesCorner = Instance.new("UICorner")
  289. clearZonesCorner.CornerRadius = UDim.new(0, 10)
  290. clearZonesCorner.Parent = clearZonesButton
  291.  
  292. -- Functions
  293. local function createTween(object, properties, duration)
  294.     duration = duration or 0.3
  295.     local tweenInfo = TweenInfo.new(duration, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
  296.     return TweenService:Create(object, tweenInfo, properties)
  297. end
  298.  
  299. local function updateZonesCount()
  300.     zonesLabel.Text = "🎯 Click Zones: " .. #clickZones
  301. end
  302.  
  303. local function createClickZone(position)
  304.     local zone = Instance.new("Frame")
  305.     zone.Name = "ClickZone"
  306.     zone.Size = UDim2.new(0, 60, 0, 60)
  307.     zone.Position = UDim2.new(0, position.X - 30, 0, position.Y - 30)
  308.     zone.BackgroundColor3 = theme.primary
  309.     zone.BackgroundTransparency = 0.5
  310.     zone.BorderSizePixel = 2
  311.     zone.BorderColor3 = theme.text
  312.     zone.ZIndex = 10
  313.     zone.Parent = screenGui
  314.    
  315.     local corner = Instance.new("UICorner")
  316.     corner.CornerRadius = UDim.new(1, 0)
  317.     corner.Parent = zone
  318.    
  319.     -- Center indicator
  320.     local center = Instance.new("Frame")
  321.     center.Name = "Center"
  322.     center.Size = UDim2.new(0, 8, 0, 8)
  323.     center.Position = UDim2.new(0.5, -4, 0.5, -4)
  324.     center.BackgroundColor3 = theme.text
  325.     center.BorderSizePixel = 0
  326.     center.Parent = zone
  327.    
  328.     local centerCorner = Instance.new("UICorner")
  329.     centerCorner.CornerRadius = UDim.new(1, 0)
  330.     centerCorner.Parent = center
  331.    
  332.     -- Close button for zone
  333.     local closeZoneBtn = Instance.new("TextButton")
  334.     closeZoneBtn.Size = UDim2.new(0, 20, 0, 20)
  335.     closeZoneBtn.Position = UDim2.new(1, -22, 0, 2)
  336.     closeZoneBtn.BackgroundColor3 = theme.error
  337.     closeZoneBtn.Text = ""
  338.     closeZoneBtn.TextColor3 = theme.text
  339.     closeZoneBtn.TextSize = 12
  340.     closeZoneBtn.Font = Enum.Font.GothamBold
  341.     closeZoneBtn.BorderSizePixel = 0
  342.     closeZoneBtn.Parent = zone
  343.    
  344.     local closeZoneCorner = Instance.new("UICorner")
  345.     closeZoneCorner.CornerRadius = UDim.new(1, 0)
  346.     closeZoneCorner.Parent = closeZoneBtn
  347.    
  348.     -- Make zone draggable
  349.     local zoneDragging = false
  350.     local zoneDragStart, zoneStartPos
  351.    
  352.     zone.InputBegan:Connect(function(input)
  353.         if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  354.             zoneDragging = true
  355.             zoneDragStart = input.Position
  356.             zoneStartPos = zone.Position
  357.            
  358.             input.Changed:Connect(function()
  359.                 if input.UserInputState == Enum.UserInputState.End then
  360.                     zoneDragging = false
  361.                 end
  362.             end)
  363.         end
  364.     end)
  365.    
  366.     zone.InputChanged:Connect(function(input)
  367.         if (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) and zoneDragging then
  368.             local delta = input.Position - zoneDragStart
  369.             zone.Position = UDim2.new(zoneStartPos.X.Scale, zoneStartPos.X.Offset + delta.X, zoneStartPos.Y.Scale, zoneStartPos.Y.Offset + delta.Y)
  370.         end
  371.     end)
  372.    
  373.     -- Remove zone on close
  374.     closeZoneBtn.MouseButton1Click:Connect(function()
  375.         for i, z in ipairs(clickZones) do
  376.             if z == zone then
  377.                 table.remove(clickZones, i)
  378.                 break
  379.             end
  380.         end
  381.         zone:Destroy()
  382.         updateZonesCount()
  383.     end)
  384.    
  385.     -- Pulse animation
  386.     local pulseIn = createTween(zone, {BackgroundTransparency = 0.3}, 0.5)
  387.     local pulseOut = createTween(zone, {BackgroundTransparency = 0.6}, 0.5)
  388.    
  389.     pulseIn.Completed:Connect(function()
  390.         pulseOut:Play()
  391.     end)
  392.    
  393.     pulseOut.Completed:Connect(function()
  394.         if zone.Parent then
  395.             pulseIn:Play()
  396.         end
  397.     end)
  398.    
  399.     pulseIn:Play()
  400.    
  401.     table.insert(clickZones, zone)
  402.     updateZonesCount()
  403.    
  404.     return zone
  405. end
  406.  
  407. local function simulateClick(position)
  408.     -- Use VirtualInputManager for accurate clicking
  409.     local vim = game:GetService("VirtualInputManager")
  410.    
  411.     -- Get the actual screen position (accounting for UI scaling)
  412.     local camera = workspace.CurrentCamera
  413.     local viewportSize = camera.ViewportSize
  414.    
  415.     -- Calculate the correct position
  416.     local actualX = position.X
  417.     local actualY = position.Y
  418.    
  419.     -- Mouse down and up to simulate click at exact position
  420.     vim:SendMouseButtonEvent(actualX, actualY, 0, true, game, 0)
  421.     task.wait(0.01)
  422.     vim:SendMouseButtonEvent(actualX, actualY, 0, false, game, 0)
  423. end
  424.  
  425. -- Auto Clicker Loop
  426. local autoClickerConnection
  427. local function startAutoClicker()
  428.     if autoClickerConnection then
  429.         autoClickerConnection:Disconnect()
  430.     end
  431.    
  432.     autoClickerConnection = RunService.Heartbeat:Connect(function()
  433.         if autoClickerEnabled and #clickZones > 0 then
  434.             for _, zone in ipairs(clickZones) do
  435.                 if zone and zone.Parent then
  436.                     -- Get the absolute position of the zone
  437.                     local absPos = zone.AbsolutePosition
  438.                     local absSize = zone.AbsoluteSize
  439.                    
  440.                     -- Calculate the center position of the zone
  441.                     local centerX = absPos.X + (absSize.X / 2)
  442.                     local centerY = absPos.Y + (absSize.Y / 2)
  443.                    
  444.                     -- Account for GUI inset (top bar on mobile/desktop)
  445.                     local guiInset = game:GetService("GuiService"):GetGuiInset()
  446.                    
  447.                     -- Adjust position with inset
  448.                     local finalX = centerX
  449.                     local finalY = centerY + guiInset.Y
  450.                    
  451.                     simulateClick(Vector2.new(finalX, finalY))
  452.                 end
  453.             end
  454.             task.wait(currentSpeed)
  455.         end
  456.     end)
  457. end
  458.  
  459. -- Button Events
  460. toggleButton.MouseButton1Click:Connect(function()
  461.     autoClickerEnabled = not autoClickerEnabled
  462.    
  463.     if autoClickerEnabled then
  464.         if #clickZones == 0 then
  465.             autoClickerEnabled = false
  466.             statusLabel.Text = "⚠️ Status: Add zones first!"
  467.             statusLabel.TextColor3 = theme.warning
  468.             return
  469.         end
  470.        
  471.         toggleButton.Text = "⏸️ STOP AUTO CLICKER"
  472.         toggleButton.BackgroundColor3 = theme.error
  473.         statusLabel.Text = "✅ Status: Active"
  474.         statusLabel.TextColor3 = theme.success
  475.         startAutoClicker()
  476.     else
  477.         toggleButton.Text = "▶️ START AUTO CLICKER"
  478.         toggleButton.BackgroundColor3 = theme.success
  479.         statusLabel.Text = "⏸️ Status: Disabled"
  480.         statusLabel.TextColor3 = theme.textSecondary
  481.     end
  482. end)
  483.  
  484. for i, btn in ipairs(speedButtons) do
  485.     btn.MouseButton1Click:Connect(function()
  486.         selectedSpeedIndex = i
  487.         currentSpeed = speedPresets[i].speed
  488.         speedLabel.Text = "⚡ Speed: " .. speedPresets[i].name
  489.        
  490.         for j, b in ipairs(speedButtons) do
  491.             b.BackgroundColor3 = j == i and theme.primary or theme.surface
  492.         end
  493.     end)
  494. end
  495.  
  496. local addingZone = false
  497. addZoneButton.MouseButton1Click:Connect(function()
  498.     if addingZone then return end
  499.     addingZone = true
  500.    
  501.     addZoneButton.Text = "👆 CLICK ANYWHERE TO PLACE"
  502.     addZoneButton.BackgroundColor3 = theme.warning
  503.    
  504.     local connection
  505.     connection = UserInputService.InputBegan:Connect(function(input)
  506.         if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  507.             local position = input.Position
  508.             createClickZone(position)
  509.            
  510.             addZoneButton.Text = "➕ ADD CLICK ZONE"
  511.             addZoneButton.BackgroundColor3 = theme.primary
  512.             addingZone = false
  513.             connection:Disconnect()
  514.         end
  515.     end)
  516. end)
  517.  
  518. clearZonesButton.MouseButton1Click:Connect(function()
  519.     for _, zone in ipairs(clickZones) do
  520.         if zone then
  521.             zone:Destroy()
  522.         end
  523.     end
  524.     clickZones = {}
  525.     updateZonesCount()
  526.    
  527.     if autoClickerEnabled then
  528.         autoClickerEnabled = false
  529.         toggleButton.Text = "▶️ START AUTO CLICKER"
  530.         toggleButton.BackgroundColor3 = theme.success
  531.         statusLabel.Text = "⏸️ Status: Disabled"
  532.         statusLabel.TextColor3 = theme.textSecondary
  533.     end
  534. end)
  535.  
  536. closeButton.MouseButton1Click:Connect(function()
  537.     if autoClickerConnection then
  538.         autoClickerConnection:Disconnect()
  539.     end
  540.     for _, zone in ipairs(clickZones) do
  541.         if zone then
  542.             zone:Destroy()
  543.         end
  544.     end
  545.     screenGui:Destroy()
  546. end)
  547.  
  548. -- Initial animation
  549. mainFrame.Size = UDim2.new(0, 0, 0, 0)
  550. createTween(mainFrame, {Size = UDim2.new(0, 350, 0, 450)}, 0.5, Enum.EasingStyle.Back):Play()
Advertisement
Add Comment
Please, Sign In to add comment