New paste Use cases Explore public pastes Text tools Developer API The Paste Library Journal Security Sign in with Google
LUACreated 2026-09-0624 viewsNo expiry

Auto Clicker [Only Roblox]

Raw New paste
luaRead-only
1
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local VirtualInputManager = game:GetService("VirtualInputManager")
local VirtualUser = game:GetService("VirtualUser")
local CoreGui = game:GetService("CoreGui")

local LocalPlayer = Players.LocalPlayer

if _G.AdvancedAutoClickerConnection then
	pcall(function()
		_G.AdvancedAutoClickerConnection:Disconnect()
	end)
	_G.AdvancedAutoClickerConnection = nil
end

_G.AdvancedAutoClickerRunning = false
task.wait(0.1)

local FONT_STYLE = Enum.Font.BuilderSansExtraBold
local CORNER_RADIUS = UDim.new(0, 5)

if CoreGui:FindFirstChild("AdvancedAutoClicker") then
	CoreGui["AdvancedAutoClicker"]:Destroy()
end

local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "AdvancedAutoClicker"
ScreenGui.Parent = CoreGui
ScreenGui.ResetOnSpawn = false

local MainFrame = Instance.new("Frame")
MainFrame.Name = "MainFrame"
MainFrame.Parent = ScreenGui
MainFrame.BackgroundColor3 = Color3.fromRGB(18, 18, 21)
MainFrame.Position = UDim2.new(0, 5, 0, 5)
MainFrame.Size = UDim2.new(0, 190, 0, 30)
MainFrame.Visible = true
MainFrame.ClipsDescendants = true

local UICornerMain = Instance.new("UICorner")
UICornerMain.CornerRadius = CORNER_RADIUS
UICornerMain.Parent = MainFrame

local TopBar = Instance.new("Frame")
TopBar.Name = "TopBar"
TopBar.Parent = MainFrame
TopBar.BackgroundColor3 = Color3.fromRGB(40, 40, 45)
TopBar.Size = UDim2.new(1, 0, 0, 30)

local UICornerTop = Instance.new("UICorner")
UICornerTop.CornerRadius = CORNER_RADIUS
UICornerTop.Parent = TopBar

local Title = Instance.new("TextLabel")
Title.Parent = TopBar
Title.BackgroundTransparency = 1
Title.Size = UDim2.new(0.65, 0, 1, 0)
Title.Position = UDim2.new(0, 8, 0, 0)
Title.Font = FONT_STYLE
Title.Text = "YouTube: Dogukan_2238"
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.TextSize = 12
Title.TextXAlignment = Enum.TextXAlignment.Left

local ToggleFrameBtn = Instance.new("TextButton")
ToggleFrameBtn.Size = UDim2.new(0, 30, 0, 22)
ToggleFrameBtn.Position = UDim2.new(1, -31, 0.5, -11)
ToggleFrameBtn.Parent = TopBar
ToggleFrameBtn.BackgroundTransparency = 1
ToggleFrameBtn.Font = FONT_STYLE
ToggleFrameBtn.Text = "↑"
ToggleFrameBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
ToggleFrameBtn.TextSize = 14

local ToggleCorner = Instance.new("UICorner")
ToggleCorner.CornerRadius = CORNER_RADIUS
ToggleCorner.Parent = ToggleFrameBtn

local ContentFrame = Instance.new("Frame")
ContentFrame.Parent = MainFrame
ContentFrame.BackgroundTransparency = 1
ContentFrame.Position = UDim2.new(0, 0, 0, 30)
ContentFrame.Size = UDim2.new(1, 0, 1, -30)
ContentFrame.Visible = false
ContentFrame.ClipsDescendants = true

local AntiAfkEnabled = false
local AutoClickerEnabled = false
local isFrameOpen = false

ToggleFrameBtn.MouseButton1Click:Connect(function()
	isFrameOpen = not isFrameOpen
	if isFrameOpen then
		ToggleFrameBtn.Text = "↓"
		MainFrame:TweenSize(UDim2.new(0, 190, 0, 125), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.15, true)
		ContentFrame.Visible = true
	else
		ToggleFrameBtn.Text = "↑"
		ContentFrame.Visible = false
		MainFrame:TweenSize(UDim2.new(0, MainFrame.AbsoluteSize.X, 0, 30), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.15, true)
	end
end)

local function CreateToggle(name, posY, getStateFunc, callback)
	local Button = Instance.new("TextButton")
	Button.Size = UDim2.new(1, -12, 0, 24)
	Button.Position = UDim2.new(0, 6, 0, posY)
	Button.Parent = ContentFrame
	Button.Font = FONT_STYLE
	Button.TextSize = 11
	Button.TextXAlignment = Enum.TextXAlignment.Left
	Button.Text = "  " .. name
	Button.BackgroundColor3 = Color3.fromRGB(40, 40, 45)
	Button.TextColor3 = Color3.fromRGB(255, 255, 255)

	local UICorner = Instance.new("UICorner")
	UICorner.CornerRadius = CORNER_RADIUS
	UICorner.Parent = Button

	local SliderBg = Instance.new("Frame")
	SliderBg.Size = UDim2.new(0, 22, 0, 11)
	SliderBg.Position = UDim2.new(1, -26, 0.5, -5.5)
	SliderBg.Parent = Button

	local CornerBg = Instance.new("UICorner")
	CornerBg.CornerRadius = CORNER_RADIUS
	CornerBg.Parent = SliderBg

	local SliderKnob = Instance.new("Frame")
	SliderKnob.Size = UDim2.new(0, 7, 0, 7)
	SliderKnob.AnchorPoint = Vector2.new(0, 0.5)
	SliderKnob.Position = UDim2.new(0, 2, 0.5, 0)
	SliderKnob.Parent = SliderBg

	local CornerKnob = Instance.new("UICorner")
	CornerKnob.CornerRadius = CORNER_RADIUS
	CornerKnob.Parent = SliderKnob

	local function updateVisuals(st)
		if st then
			SliderBg.BackgroundColor3 = Color3.fromRGB(46, 204, 113)
			SliderKnob.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
			SliderKnob.Position = UDim2.new(1, -9, 0.5, 0)
		else
			SliderBg.BackgroundColor3 = Color3.fromRGB(90, 90, 90)
			SliderKnob.BackgroundColor3 = Color3.fromRGB(200, 200, 200)
			SliderKnob.Position = UDim2.new(0, 2, 0.5, 0)
		end
	end
    
	updateVisuals(getStateFunc())

	Button.MouseButton1Click:Connect(function()
		local newState = not getStateFunc()
		updateVisuals(newState)
		callback(newState)
	end)
end

CreateToggle("Anti-AFK", 6, function() return AntiAfkEnabled end, function(state)
	AntiAfkEnabled = state
end)

CreateToggle("Auto Clicker", 34, function() return AutoClickerEnabled end, function(state)
	AutoClickerEnabled = state
end)

local targetButton = nil
local targetVisible = false

local TargetToggleBtn = Instance.new("TextButton")
TargetToggleBtn.Size = UDim2.new(1, -12, 0, 26)
TargetToggleBtn.Position = UDim2.new(0, 6, 0, 62)
TargetToggleBtn.Parent = ContentFrame
TargetToggleBtn.Font = FONT_STYLE
TargetToggleBtn.TextSize = 11
TargetToggleBtn.TextXAlignment = Enum.TextXAlignment.Center
TargetToggleBtn.Text = "Add Target"
TargetToggleBtn.BackgroundColor3 = Color3.fromRGB(46, 204, 113)
TargetToggleBtn.TextColor3 = Color3.fromRGB(255, 255, 255)

local TargetToggleCorner = Instance.new("UICorner")
TargetToggleCorner.CornerRadius = CORNER_RADIUS
TargetToggleCorner.Parent = TargetToggleBtn

local function makeDraggable(guiObj, handle)
	local dragging, dragInput, dragStart, startPos
	handle.InputBegan:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
			dragging = true
			dragStart = input.Position
			startPos = guiObj.Position
			input.Changed:Connect(function()
				if input.UserInputState == Enum.UserInputState.End then
					dragging = false
				end
			end)
		end
	end)
	handle.InputChanged:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
			dragInput = input
		end
	end)
	UserInputService.InputChanged:Connect(function(input)
		if input == dragInput and dragging then
			local delta = input.Position - dragStart
			guiObj.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
		end
	end)
end

TargetToggleBtn.MouseButton1Click:Connect(function()
	targetVisible = not targetVisible
	if targetVisible then
		TargetToggleBtn.Text = "Remove Target"
		TargetToggleBtn.BackgroundColor3 = Color3.fromRGB(231, 76, 60)
		
		if not targetButton then
			targetButton = Instance.new("TextButton")
			targetButton.Size = UDim2.new(0, 42, 0, 42)
			targetButton.Position = UDim2.new(0.5, -21, 0.7, -21)
			targetButton.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
			targetButton.Text = ""
			targetButton.Parent = ScreenGui

			local tCorner = Instance.new("UICorner")
			tCorner.CornerRadius = UDim.new(1, 0)
			tCorner.Parent = targetButton

			local tStroke = Instance.new("UIStroke")
			tStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
			tStroke.LineJoinMode = Enum.LineJoinMode.Round
			tStroke.Thickness = 3
			tStroke.Color = Color3.fromRGB(60, 60, 60)
			tStroke.Parent = targetButton

			local mouseIcon = Instance.new("ImageLabel")
			mouseIcon.Size = UDim2.new(0, 30, 0, 30)
			mouseIcon.AnchorPoint = Vector2.new(0.5, 0.5)
			mouseIcon.Position = UDim2.new(0.5, 0, 0.5, 0)
			mouseIcon.BackgroundTransparency = 1
			mouseIcon.Image = "rbxassetid://92690468136015"
			mouseIcon.ImageColor3 = Color3.fromRGB(255, 255, 255)
			mouseIcon.Parent = targetButton

			makeDraggable(targetButton, targetButton)
		end
		targetButton.Visible = true
	else
		TargetToggleBtn.Text = "Add Target"
		TargetToggleBtn.BackgroundColor3 = Color3.fromRGB(46, 204, 113)
		if targetButton then
			targetButton.Visible = false
		end
	end
end)

_G.AdvancedAutoClickerConnection = LocalPlayer.Idled:Connect(function()
	if AntiAfkEnabled then
		VirtualUser:CaptureController()
		VirtualUser:ClickButton2(Vector2.new())
	end
end)

RunService.RenderStepped:Connect(function()
	if AutoClickerEnabled and targetVisible and targetButton and targetButton.Visible then
		pcall(function()
			local absPos = targetButton.AbsolutePosition
			local absSize = targetButton.AbsoluteSize
			local targetX = absPos.X + (absSize.X / 2)
			local targetY = absPos.Y + (absSize.Y / 2)
			
			VirtualInputManager:SendMouseButtonEvent(targetX, targetY, 0, true, game, 1)
			VirtualInputManager:SendMouseButtonEvent(targetX, targetY, 0, false, game, 1)
		end)
	end
end)

makeDraggable(MainFrame, TopBar)

ScreenGui.AncestryChanged:Connect(function(_, parent)
	if not parent then
		AntiAfkEnabled = false
		AutoClickerEnabled = false
		targetVisible = false
		if targetButton then
			targetButton:Destroy()
			targetButton = nil
		end
		if _G.AdvancedAutoClickerConnection then
			pcall(function() _G.AdvancedAutoClickerConnection:Disconnect() end)
			_G.AdvancedAutoClickerConnection = nil
		end
	end
end)
Report abuse

Paste details

Visibility
Public
Size
9.6 KB
Protection
Standard link access
Retention
No automatic expiry

Share with confidence

Unlisted links are not searchable, but anyone with the URL can open them. Never paste live credentials or personal data.