-- Create GUI Elements local ScreenGui = Instance.new("ScreenGui") local ToggleButton = Instance.new("TextButton") -- Parent GUI to Player's ScreenGui ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui") -- Setup Toggle Button ToggleButton.Size = UDim2.new(0, 200, 0, 50) ToggleButton.Position = UDim2.new(0.5, -100, 0.9, -25) -- Centered at the bottom ToggleButton.Text = "Auto Click: OFF" ToggleButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Red for OFF ToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255) ToggleButton.Parent = ScreenGui -- Variables local autoClickEnabled = false -- Function to toggle Auto Click ToggleButton.MouseButton1Click:Connect(function() autoClickEnabled = not autoClickEnabled if autoClickEnabled then ToggleButton.Text = "Auto Click: ON" ToggleButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0) -- Green for ON startAutoClick() else ToggleButton.Text = "Auto Click: OFF" ToggleButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) -- Red for OFF end end) -- Function to start auto-clicking function startAutoClick() spawn(function() while autoClickEnabled do for _, part in ipairs(workspace:GetDescendants()) do if part:IsA("ClickDetector") and part.Parent then fireclickdetector(part) wait(0.1) -- Adjust the delay as needed end end wait(0.5) -- Delay between full scans of the workspace end end) end