-- Auto-Clicker Script using mouse1press/mouse1release
-- This script uses the more direct mouse1press and mouse1release functions

-- Services
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

-- CONFIGURATION
local clickDelay = 1/30 -- For 30 clicks per second
local toggleKey = Enum.KeyCode.R

-- Variables
local autoClickEnabled = false
local clickConnection = nil
local clicksThisSecond = 0
local lastCpsReset = tick()

-- Create a simple GUI
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "SimpleAutoClicker"
ScreenGui.ResetOnSpawn = false
-- Try to place in CoreGui, but fallback to PlayerGui if needed
pcall(function()
    ScreenGui.Parent = game:GetService("CoreGui")
end)
if not ScreenGui.Parent then
    ScreenGui.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
end

local Frame = Instance.new("Frame")
Frame.Size = UDim2.new(0, 200, 0, 80)  -- Reduced height since we removed counters
Frame.Position = UDim2.new(0.5, -100, 0, 10)
Frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
Frame.BorderSizePixel = 0
Frame.Parent = ScreenGui

local UICorner = Instance.new("UICorner")
UICorner.CornerRadius = UDim.new(0, 10)
UICorner.Parent = Frame

local Title = Instance.new("TextLabel")
Title.Size = UDim2.new(1, 0, 0, 25)
Title.Position = UDim2.new(0, 0, 0, 5)
Title.BackgroundTransparency = 1
Title.Text = "AUTO CLICKER (30 CPS)"
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.Font = Enum.Font.GothamBold
Title.TextSize = 14
Title.Parent = Frame

local StatusText = Instance.new("TextLabel")
StatusText.Size = UDim2.new(1, 0, 0, 20)
StatusText.Position = UDim2.new(0, 0, 0, 30)
StatusText.BackgroundTransparency = 1
StatusText.Text = "OFF [Press R to toggle]"
StatusText.TextColor3 = Color3.fromRGB(255, 100, 100)
StatusText.Font = Enum.Font.Gotham
StatusText.TextSize = 14
StatusText.Parent = Frame

-- Add CPS display
local CpsCounter = Instance.new("TextLabel")
CpsCounter.Size = UDim2.new(1, 0, 0, 20)
CpsCounter.Position = UDim2.new(0, 0, 0, 55)
CpsCounter.BackgroundTransparency = 1
CpsCounter.TextColor3 = Color3.fromRGB(255, 255, 0)
CpsCounter.Text = "CPS: 0"
CpsCounter.Font = Enum.Font.Gotham
CpsCounter.TextSize = 14
CpsCounter.Parent = Frame

-- Ensure we have the required functions
local canUseDirectFunctions = true
if not mouse1press or not mouse1release then
    canUseDirectFunctions = false
    StatusText.Text = "ERROR: Missing Required Functions"
    StatusText.TextColor3 = Color3.fromRGB(255, 0, 0)
    print("Error: This script requires mouse1press and mouse1release functions")
    print("Your executor doesn't support these functions or they're named differently")
end

-- Function to update CPS counter
local function updateCpsCounter()
    -- Only update when running
    if autoClickEnabled then
        RunService.Heartbeat:Connect(function()
            local currentTime = tick()
            -- Reset counter every second
            if currentTime - lastCpsReset >= 1 then
                CpsCounter.Text = "CPS: " .. clicksThisSecond
                clicksThisSecond = 0
                lastCpsReset = currentTime
            end
        end)
    else
        -- When disabled, show 0 CPS
        CpsCounter.Text = "CPS: 0"
    end
end

-- CORE FUNCTIONALITY
local function startAutoClick()
    if not canUseDirectFunctions then return end
    
    -- Stop any existing connection
    if clickConnection then
        clickConnection:Disconnect()
        clickConnection = nil
    end
    
    -- Reset CPS tracking variables
    clicksThisSecond = 0
    lastCpsReset = tick()
    
    -- Start a new clicking loop
    local lastClick = tick()
    
    clickConnection = RunService.Heartbeat:Connect(function()
        local currentTime = tick()
        
        -- Only click if enough time has passed
        if currentTime - lastClick >= clickDelay then
            -- Directly press and release mouse
            mouse1press()
            task.delay(0.01, function() 
                mouse1release()
            end)
            
            -- Increment click counter for CPS tracking
            clicksThisSecond = clicksThisSecond + 1
            
            -- Update timing
            lastClick = currentTime
        end
        
        -- Update CPS counter once per second
        if currentTime - lastCpsReset >= 1 then
            CpsCounter.Text = "CPS: " .. clicksThisSecond
            clicksThisSecond = 0
            lastCpsReset = currentTime
        end
    end)
end

local function stopAutoClick()
    if clickConnection then
        clickConnection:Disconnect()
        clickConnection = nil
    end
    -- Reset CPS display when stopped
    CpsCounter.Text = "CPS: 0"
end

-- Toggle auto clicker function
local function toggleAutoClicker()
    if not canUseDirectFunctions then return end
    
    autoClickEnabled = not autoClickEnabled
    
    if autoClickEnabled then
        StatusText.Text = "ON [Press R to toggle]"
        StatusText.TextColor3 = Color3.fromRGB(100, 255, 100)
        startAutoClick()
        print("Auto-clicker enabled - 30 CPS")
    else
        StatusText.Text = "OFF [Press R to toggle]"
        StatusText.TextColor3 = Color3.fromRGB(255, 100, 100)
        stopAutoClick()
        print("Auto-clicker disabled")
    end
end

-- Input handling
UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if not gameProcessed then
        -- Toggle with the R key
        if input.KeyCode == toggleKey then
            toggleAutoClicker()
        end
    end
end)

-- Make the GUI draggable
local dragging = false
local dragInput
local dragStart
local startPos

local function updateDrag(input)
    local delta = input.Position - dragStart
    Frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
end

Frame.InputBegan:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        dragging = true
        dragStart = input.Position
        startPos = Frame.Position
        
        input.Changed:Connect(function()
            if input.UserInputState == Enum.UserInputState.End then
                dragging = false
            end
        end)
    end
end)

Frame.InputChanged:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseMovement then
        dragInput = input
    end
end)

UserInputService.InputChanged:Connect(function(input)
    if input == dragInput and dragging then
        updateDrag(input)
    end
end)

-- Notification
print("Auto-Clicker loaded")
print("Press R to toggle auto-clicking at 30 CPS")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: