local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local VirtualUser = game:GetService("VirtualUser") local LocalPlayer = Players.LocalPlayer local PlayerGui = gethui and gethui() or game.CoreGui local State = { Hours = 0, Mins = 0, Secs = 0, Milliseconds = 100, MouseButton = "Left", ClickType = "Single", RepeatMode = "RepeatUntilStopped", RepeatTimes = 1, CursorMode = "CurrentLocation", PickX = 0, PickY = 0, IsRunning = false, IsFocused = false, HotkeyOpen = false, HotkeyLabel = "CTRL+D", HotkeyModifier = Enum.KeyCode.LeftControl, HotkeyKey = Enum.KeyCode.One } local Theme = { TitleBarActive = Color3.fromRGB(0, 120, 215), TitleBarInactive = Color3.fromRGB(155, 155, 155), TitleText = Color3.fromRGB(255, 255, 255), WindowBg = Color3.fromRGB(240, 240, 240), SectionText = Color3.fromRGB(0, 0, 0), Divider = Color3.fromRGB(180, 180, 180), InputBg = Color3.fromRGB(255, 255, 255), InputBorder = Color3.fromRGB(120, 120, 120), ButtonBg = Color3.fromRGB(225, 225, 225), ButtonBorder = Color3.fromRGB(140, 140, 140), ButtonHover = Color3.fromRGB(210, 228, 252), RadioActive = Color3.fromRGB(0, 120, 215), RadioInactive = Color3.fromRGB(255, 255, 255), DropdownArrow = Color3.fromRGB(80, 80, 80), LabelColor = Color3.fromRGB(30, 30, 30), DisabledText = Color3.fromRGB(160, 160, 160), PickCircle = Color3.fromRGB(0, 120, 215) } local function Make(class, props, children) local object = Instance.new(class) for key, value in pairs(props) do if key ~= "Parent" then object[key] = value end end if children then for _, child in ipairs(children) do child.Parent = object end end if props.Parent then object.Parent = props.Parent end return object end local function MakeLabel(props) return Make("TextLabel", { BackgroundTransparency = 1, TextColor3 = props.TextColor3 or Theme.LabelColor, TextSize = props.TextSize or 13, Font = Enum.Font.Arial, TextXAlignment = props.TextXAlignment or Enum.TextXAlignment.Left, TextYAlignment = props.TextYAlignment or Enum.TextYAlignment.Center, Text = props.Text or "", Size = props.Size or UDim2.new(1, 0, 0, 18), Position = props.Position or UDim2.new(0, 0, 0, 0), Parent = props.Parent, Name = props.Name or "Label", }) end local function MakeDivider(parent, yPosition) Make("Frame", { Size = UDim2.new(1, -16, 0, 1), Position = UDim2.new(0, 8, 0, yPosition), BackgroundColor3 = Theme.Divider, BorderSizePixel = 0, Parent = parent, Name = "Divider", }) end local ScreenGui = Make("ScreenGui", { Name = "AutoClickerGui", ResetOnSpawn = false, ZIndexBehavior = Enum.ZIndexBehavior.Sibling, Parent = PlayerGui, }) local MainWindow = Make("Frame", { Name = "MainWindow", Size = UDim2.new(0, 390, 0, 325), Position = UDim2.new(0.5, -195, 0.5, -162), BackgroundColor3 = Theme.WindowBg, BorderSizePixel = 0, Parent = ScreenGui, Active = true, Draggable = true, }) Make("UICorner", { CornerRadius = UDim.new(0, 5), Parent = MainWindow }) local TitleBar = Make("Frame", { Name = "TitleBar", Size = UDim2.new(1, 0, 0, 28), BackgroundColor3 = Theme.TitleBarInactive, BorderSizePixel = 0, Parent = MainWindow, }) Make("UICorner", { CornerRadius = UDim.new(0, 5), Parent = TitleBar }) local TitleBarBottom = Make("Frame", { Size = UDim2.new(1, 0, 0, 8), Position = UDim2.new(0, 0, 1, -4), BackgroundColor3 = Theme.TitleBarInactive, BorderSizePixel = 0, Parent = TitleBar, }) local TitleLabel = MakeLabel({ Text = "Stopped - OP Auto Clicker 3.1.1", Size = UDim2.new(1, -60, 1, 0), Position = UDim2.new(0, 8, 0, 0), TextColor3 = Theme.TitleText, TextSize = 13, Font = Enum.Font.Arial, TextXAlignment = Enum.TextXAlignment.Left, Parent = TitleBar, Name = "TitleLabel", }) local CloseButton = Make("TextButton", { Name = "CloseButton", Size = UDim2.new(0, 28, 0, 28), Position = UDim2.new(1, -28, 0, 0), BackgroundColor3 = Color3.fromRGB(232, 17, 35), BorderSizePixel = 0, Text = "X", TextColor3 = Color3.fromRGB(255, 255, 255), TextSize = 13, Font = Enum.Font.GothamBold, Parent = TitleBar, }) CloseButton.MouseButton1Click:Connect(function() ScreenGui:Destroy() end) local Body = Make("Frame", { Name = "Body", Size = UDim2.new(1, 0, 1, -28), Position = UDim2.new(0, 0, 0, 28), BackgroundTransparency = 1, Parent = MainWindow, }) MainWindow.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then State.IsFocused = true TitleBar.BackgroundColor3 = Theme.TitleBarActive TitleBarBottom.BackgroundColor3 = Theme.TitleBarActive end end) UserInputService.InputBegan:Connect(function(input) if input.UserInputType ~= Enum.UserInputType.MouseButton1 then return end local guiObjects = PlayerGui:GetGuiObjectsAtPosition(input.Position.X, input.Position.Y) local overWindow = false for _, object in ipairs(guiObjects) do if object:IsDescendantOf(MainWindow) or object == MainWindow then overWindow = true break end end if not overWindow then State.IsFocused = false TitleBar.BackgroundColor3 = Theme.TitleBarInactive TitleBarBottom.BackgroundColor3 = Theme.TitleBarInactive end end) MakeLabel({ Text = "Click interval", Position = UDim2.new(0, 8, 0, 8), Size = UDim2.new(1, -16, 0, 16), TextSize = 13, Parent = Body, Name = "ClickIntervalLabel", }) local function MakeIntervalBox(parent, label, defaultValue, xPosition, yPosition, width, stateKey) local container = Make("Frame", { Size = UDim2.new(0, width, 0, 36), Position = UDim2.new(0, xPosition, 0, yPosition), BackgroundTransparency = 1, Parent = parent, Name = label .. "Container", }) local box = Make("TextBox", { Name = "InputBox", Size = UDim2.new(1, 0, 0, 20), Position = UDim2.new(0, 0, 0, 0), BackgroundColor3 = Theme.InputBg, BorderColor3 = Theme.InputBorder, BorderSizePixel = 1, Text = tostring(defaultValue), TextColor3 = Theme.LabelColor, TextSize = 13, Font = Enum.Font.Arial, ClearTextOnFocus = false, TextXAlignment = Enum.TextXAlignment.Center, Parent = container, }) Make("UICorner", { CornerRadius = UDim.new(0, 2), Parent = box }) MakeLabel({ Text = label, Size = UDim2.new(1, 0, 0, 14), Position = UDim2.new(0, 0, 0, 21), TextSize = 11, TextXAlignment = Enum.TextXAlignment.Center, Parent = container, }) box.FocusLost:Connect(function() local number = tonumber(box.Text) if number then State[stateKey] = math.max(0, math.floor(number)) box.Text = tostring(State[stateKey]) else box.Text = tostring(State[stateKey]) end end) return box end local intervalY = 26 MakeIntervalBox(Body, "hours", State.Hours, 8, intervalY, 68, "Hours") MakeIntervalBox(Body, "mins", State.Mins, 84, intervalY, 68, "Mins") MakeIntervalBox(Body, "secs", State.Secs, 160, intervalY, 68, "Secs") MakeIntervalBox(Body, "milliseconds", State.Milliseconds, 236, intervalY, 140, "Milliseconds") local CpsLabel = MakeLabel({ Text = "CPS: 0.00", Position = UDim2.new(0, 8, 0, 62), Size = UDim2.new(1, -16, 0, 14), TextSize = 11, TextColor3 = Theme.DisabledText, Parent = Body, Name = "CpsLabel", }) MakeDivider(Body, 82) MakeLabel({ Text = "Click options", Position = UDim2.new(0, 8, 0, 88), Size = UDim2.new(0, 175, 0, 16), TextSize = 13, Parent = Body, Name = "ClickOptionsLabel", }) MakeLabel({ Text = "Click repeat", Position = UDim2.new(0, 195, 0, 88), Size = UDim2.new(0, 175, 0, 16), TextSize = 13, Parent = Body, Name = "ClickRepeatLabel", }) Make("Frame", { Size = UDim2.new(0, 1, 0, 60), Position = UDim2.new(0, 188, 0, 88), BackgroundColor3 = Theme.Divider, BorderSizePixel = 0, Parent = Body, Name = "VertDivider", }) MakeLabel({ Text = "Mouse button:", Position = UDim2.new(0, 8, 0, 107), Size = UDim2.new(0, 85, 0, 16), TextSize = 12, Parent = Body, }) MakeLabel({ Text = "Click type:", Position = UDim2.new(0, 8, 0, 130), Size = UDim2.new(0, 85, 0, 16), TextSize = 12, Parent = Body, }) local OpenDropdown = nil local function MakeDropdown(parent, options, stateKey, xPosition, yPosition, width) local isOpen = false local zIndex = 10 local container = Make("Frame", { Size = UDim2.new(0, width, 0, 20), Position = UDim2.new(0, xPosition, 0, yPosition), BackgroundColor3 = Theme.InputBg, BorderColor3 = Theme.InputBorder, BorderSizePixel = 1, ZIndex = zIndex, Parent = parent, Name = stateKey .. "Dropdown", ClipsDescendants = false, }) Make("UICorner", { CornerRadius = UDim.new(0, 2), Parent = container }) local selected = Make("TextLabel", { Name = "Selected", Size = UDim2.new(1, -20, 1, 0), Position = UDim2.new(0, 4, 0, 0), BackgroundTransparency = 1, Text = State[stateKey], TextColor3 = Theme.LabelColor, TextSize = 12, Font = Enum.Font.Arial, TextXAlignment = Enum.TextXAlignment.Left, ZIndex = zIndex, Parent = container, }) Make("TextLabel", { Size = UDim2.new(0, 18, 1, 0), Position = UDim2.new(1, -18, 0, 0), BackgroundTransparency = 1, Text = "▼", TextColor3 = Theme.DropdownArrow, TextSize = 10, Font = Enum.Font.Arial, ZIndex = zIndex, Parent = container, }) local list = Make("Frame", { Name = "List", Size = UDim2.new(1, 0, 0, #options * 20), Position = UDim2.new(0, 0, 1, 1), BackgroundColor3 = Theme.InputBg, BorderColor3 = Theme.InputBorder, BorderSizePixel = 1, Visible = false, ZIndex = zIndex + 5, Parent = container, }) Make("UICorner", { CornerRadius = UDim.new(0, 2), Parent = list }) for index, option in ipairs(options) do local item = Make("TextButton", { Size = UDim2.new(1, 0, 0, 20), Position = UDim2.new(0, 0, 0, (index - 1) * 20), BackgroundColor3 = Theme.InputBg, BorderSizePixel = 0, Text = option, TextColor3 = Theme.LabelColor, TextSize = 12, Font = Enum.Font.Arial, TextXAlignment = Enum.TextXAlignment.Left, ZIndex = zIndex + 5, Parent = list, Name = option, }) Make("UIPadding", { PaddingLeft = UDim.new(0, 6), Parent = item }) item.MouseEnter:Connect(function() item.BackgroundColor3 = Theme.ButtonHover end) item.MouseLeave:Connect(function() item.BackgroundColor3 = Theme.InputBg end) item.MouseButton1Click:Connect(function() State[stateKey] = option selected.Text = option list.Visible = false isOpen = false OpenDropdown = nil end) end local toggleButton = Make("TextButton", { Size = UDim2.new(1, 0, 1, 0), BackgroundTransparency = 1, Text = "", ZIndex = zIndex + 1, Parent = container, }) toggleButton.MouseButton1Click:Connect(function() if OpenDropdown and OpenDropdown ~= list then OpenDropdown.Visible = false end isOpen = not isOpen list.Visible = isOpen if isOpen then OpenDropdown = list else OpenDropdown = nil end end) UserInputService.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 and isOpen then local position = input.Position local containerPosition = container.AbsolutePosition local containerSize = container.AbsoluteSize local listSize = list.AbsoluteSize local inContainer = position.X >= containerPosition.X and position.X <= containerPosition.X + containerSize.X and position.Y >= containerPosition.Y and position.Y <= containerPosition.Y + containerSize.Y + listSize.Y if not inContainer then isOpen = false list.Visible = false OpenDropdown = nil end end end) return container end MakeDropdown(Body, {"Left", "Middle", "Right"}, "MouseButton", 96, 105, 82) MakeDropdown(Body, {"Single", "Double"}, "ClickType", 96, 128, 82) local function MakeRadio(parent, label, modeValue, xPosition, yPosition, stateKey) local container = Make("Frame", { Size = UDim2.new(0, 170, 0, 18), Position = UDim2.new(0, xPosition, 0, yPosition), BackgroundTransparency = 1, Parent = parent, Name = label .. "Radio", }) local outer = Make("Frame", { Size = UDim2.new(0, 14, 0, 14), Position = UDim2.new(0, 0, 0, 2), BackgroundColor3 = Theme.RadioInactive, BorderColor3 = Theme.InputBorder, BorderSizePixel = 1, Parent = container, Name = "Outer", }) Make("UICorner", { CornerRadius = UDim.new(1, 0), Parent = outer }) local inner = Make("Frame", { Size = UDim2.new(0, 8, 0, 8), Position = UDim2.new(0, 3, 0, 3), BackgroundColor3 = Theme.RadioActive, BorderSizePixel = 0, Visible = State[stateKey] == modeValue, Parent = outer, Name = "Inner", }) Make("UICorner", { CornerRadius = UDim.new(1, 0), Parent = inner }) MakeLabel({ Text = label, Position = UDim2.new(0, 18, 0, 0), Size = UDim2.new(1, -18, 1, 0), TextSize = 12, Parent = container, }) local hitBox = Make("TextButton", { Size = UDim2.new(1, 0, 1, 0), BackgroundTransparency = 1, Text = "", Parent = container, }) return inner, hitBox end local RepeatDot, RepeatHit = MakeRadio(Body, "Repeat", "Repeat", 196, 105, "RepeatMode") local UntilDot, UntilHit = MakeRadio(Body, "Repeat until stopped", "RepeatUntilStopped", 196, 126, "RepeatMode") local RepeatTimesBox = Make("TextBox", { Name = "RepeatTimesBox", Size = UDim2.new(0, 36, 0, 18), Position = UDim2.new(0, 268, 0, 105), BackgroundColor3 = Theme.InputBg, BorderColor3 = Theme.InputBorder, BorderSizePixel = 1, Text = tostring(State.RepeatTimes), TextColor3 = Theme.LabelColor, TextSize = 12, Font = Enum.Font.Arial, ClearTextOnFocus = false, TextXAlignment = Enum.TextXAlignment.Center, Parent = Body, }) Make("UICorner", { CornerRadius = UDim.new(0, 2), Parent = RepeatTimesBox }) MakeLabel({ Text = "times", Position = UDim2.new(0, 308, 0, 105), Size = UDim2.new(0, 40, 0, 18), TextSize = 12, Parent = Body, }) RepeatTimesBox.FocusLost:Connect(function() local number = tonumber(RepeatTimesBox.Text) State.RepeatTimes = math.max(1, math.floor(number or 1)) RepeatTimesBox.Text = tostring(State.RepeatTimes) end) local function UpdateRepeatRadios() RepeatDot.Visible = (State.RepeatMode == "Repeat") UntilDot.Visible = (State.RepeatMode == "RepeatUntilStopped") RepeatTimesBox.TextColor3 = (State.RepeatMode == "Repeat") and Theme.LabelColor or Theme.DisabledText end RepeatHit.MouseButton1Click:Connect(function() State.RepeatMode = "Repeat" UpdateRepeatRadios() end) UntilHit.MouseButton1Click:Connect(function() State.RepeatMode = "RepeatUntilStopped" UpdateRepeatRadios() end) UpdateRepeatRadios() MakeDivider(Body, 152) MakeLabel({ Text = "Cursor position", Position = UDim2.new(0, 8, 0, 158), Size = UDim2.new(1, -16, 0, 16), TextSize = 13, Parent = Body, Name = "CursorPosLabel", }) local CurLocDot, CurLocHit = MakeRadio(Body, "Current location", "CurrentLocation", 8, 177, "CursorMode") local PickDot, PickHit = MakeRadio(Body, "", "PickLocation", 196, 177, "CursorMode") local PickButton = Make("TextButton", { Name = "PickButton", Size = UDim2.new(0, 88, 0, 20), Position = UDim2.new(0, 214, 0, 175), BackgroundColor3 = Theme.ButtonBg, BorderColor3 = Theme.ButtonBorder, BorderSizePixel = 1, Text = "Pick location", TextColor3 = Theme.LabelColor, TextSize = 12, Font = Enum.Font.Arial, Parent = Body, }) Make("UICorner", { CornerRadius = UDim.new(0, 2), Parent = PickButton }) MakeLabel({ Text = "X", Position = UDim2.new(0, 308, 0, 177), Size = UDim2.new(0, 10, 0, 18), TextSize = 12, Parent = Body }) local PickXBox = Make("TextBox", { Size = UDim2.new(0, 28, 0, 18), Position = UDim2.new(0, 318, 0, 177), BackgroundColor3 = Theme.InputBg, BorderColor3 = Theme.InputBorder, BorderSizePixel = 1, Text = "0", TextColor3 = Theme.LabelColor, TextSize = 11, Font = Enum.Font.Arial, ClearTextOnFocus = false, TextXAlignment = Enum.TextXAlignment.Center, Parent = Body, }) Make("UICorner", { CornerRadius = UDim.new(0, 2), Parent = PickXBox }) MakeLabel({ Text = "Y", Position = UDim2.new(0, 350, 0, 177), Size = UDim2.new(0, 10, 0, 18), TextSize = 12, Parent = Body }) local PickYBox = Make("TextBox", { Size = UDim2.new(0, 28, 0, 18), Position = UDim2.new(0, 360, 0, 177), BackgroundColor3 = Theme.InputBg, BorderColor3 = Theme.InputBorder, BorderSizePixel = 1, Text = "0", TextColor3 = Theme.LabelColor, TextSize = 11, Font = Enum.Font.Arial, ClearTextOnFocus = false, TextXAlignment = Enum.TextXAlignment.Center, Parent = Body, }) Make("UICorner", { CornerRadius = UDim.new(0, 2), Parent = PickYBox }) PickXBox.FocusLost:Connect(function() State.PickX = math.floor(tonumber(PickXBox.Text) or 0) PickXBox.Text = tostring(State.PickX) end) PickYBox.FocusLost:Connect(function() State.PickY = math.floor(tonumber(PickYBox.Text) or 0) PickYBox.Text = tostring(State.PickY) end) local function UpdateCursorRadios() CurLocDot.Visible = (State.CursorMode == "CurrentLocation") PickDot.Visible = (State.CursorMode == "PickLocation") end CurLocHit.MouseButton1Click:Connect(function() State.CursorMode = "CurrentLocation" UpdateCursorRadios() end) PickHit.MouseButton1Click:Connect(function() State.CursorMode = "PickLocation" UpdateCursorRadios() end) local PickCircle = nil local PickPositionLabel = nil PickButton.MouseButton1Click:Connect(function() State.CursorMode = "PickLocation" UpdateCursorRadios() if PickCircle then PickCircle:Destroy() end if PickPositionLabel then PickPositionLabel:Destroy() end PickCircle = Make("Frame", { Size = UDim2.new(0, 20, 0, 20), AnchorPoint = Vector2.new(0.5, 0.5), BackgroundTransparency = 0.8, BackgroundColor3 = Theme.PickCircle, BorderSizePixel = 0, Parent = ScreenGui, ZIndex = 100, }) Make("UICorner", { CornerRadius = UDim.new(1, 0), Parent = PickCircle }) Make("UIStroke", { Color = Theme.PickCircle, Thickness = 2, Parent = PickCircle }) PickPositionLabel = Make("TextLabel", { Size = UDim2.new(0, 80, 0, 18), BackgroundTransparency = 0.2, BackgroundColor3 = Color3.fromRGB(0, 0, 0), TextColor3 = Color3.fromRGB(255, 255, 255), TextSize = 10, Font = Enum.Font.Arial, TextXAlignment = Enum.TextXAlignment.Center, Parent = ScreenGui, ZIndex = 101, }) Make("UICorner", { CornerRadius = UDim.new(0, 2), Parent = PickPositionLabel }) local mouseConnection = RunService.RenderStepped:Connect(function() local mouse = LocalPlayer:GetMouse() PickCircle.Position = UDim2.new(0, mouse.X, 0, mouse.Y) PickPositionLabel.Position = UDim2.new(0, mouse.X + 15, 0, mouse.Y - 25) PickPositionLabel.Text = string.format("X:%d Y:%d", mouse.X, mouse.Y) end) local clickConnection clickConnection = UserInputService.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then State.PickX = math.floor(input.Position.X) State.PickY = math.floor(input.Position.Y) PickXBox.Text = tostring(State.PickX) PickYBox.Text = tostring(State.PickY) mouseConnection:Disconnect() clickConnection:Disconnect() if PickCircle then PickCircle:Destroy() end if PickPositionLabel then PickPositionLabel:Destroy() end PickCircle = nil PickPositionLabel = nil end end) end) UpdateCursorRadios() MakeDivider(Body, 204) local function MakeButton(label, xPosition, yPosition, width, height) local button = Make("TextButton", { Name = label:gsub("%s+", ""):gsub("%(", ""):gsub("%)", ""):gsub("CTRL+D", "") .. "Button", Size = UDim2.new(0, width, 0, height), Position = UDim2.new(0, xPosition, 0, yPosition), BackgroundColor3 = Theme.ButtonBg, BorderColor3 = Theme.ButtonBorder, BorderSizePixel = 0, Text = label, TextColor3 = Theme.LabelColor, TextSize = 13, Font = Enum.Font.Arial, Parent = Body, }) Make("UICorner", { CornerRadius = UDim.new(0, 2), Parent = button }) button.MouseEnter:Connect(function() button.BackgroundColor3 = Theme.ButtonHover end) button.MouseLeave:Connect(function() button.BackgroundColor3 = Theme.ButtonBg end) return button end local StartButton = MakeButton("Start (CTRL+D)", 8, 212, 178, 32) local StopButton = MakeButton("Stop (CTRL+D)", 204, 212, 178, 32) local HotkeyButton = MakeButton("Hotkey setting", 8, 250, 178, 28) local RecordButton = MakeButton("Record & Playback", 204, 250, 178, 28) StopButton.TextColor3 = Theme.DisabledText StopButton.Active = false local ClickConnection = nil local ClickCount = 0 local LastClickTime = 0 local ClickTimes = {} local function UpdateCps() local intervalSeconds = State.Hours * 3600 + State.Mins * 60 + State.Secs + State.Milliseconds / 1000 if intervalSeconds <= 0 then intervalSeconds = 0.001 end local cps = 1 / intervalSeconds if State.ClickType == "Double" then cps = cps * 2 end CpsLabel.Text = string.format("CPS: %.2f", cps) end UpdateCps() local function UpdateTitle() if State.IsRunning then TitleLabel.Text = "Clicking - OP Auto Clicker 3.1.1" else TitleLabel.Text = "Stopped - OP Auto Clicker 3.1.1" end end local function PerformClick() local mouse = LocalPlayer:GetMouse() local x = State.CursorMode == "PickLocation" and State.PickX or mouse.X local y = State.CursorMode == "PickLocation" and State.PickY or mouse.Y if State.MouseButton == "Left" then VirtualUser:CaptureController() VirtualUser:ClickButton1(Vector2.new(x, y)) elseif State.MouseButton == "Right" then VirtualUser:CaptureController() VirtualUser:ClickButton2(Vector2.new(x, y)) elseif State.MouseButton == "Middle" then VirtualUser:CaptureController() VirtualUser:ClickButton1(Vector2.new(x, y)) end if State.ClickType == "Double" then task.wait(0.05) if State.MouseButton == "Left" then VirtualUser:CaptureController() VirtualUser:ClickButton1(Vector2.new(x, y)) elseif State.MouseButton == "Right" then VirtualUser:CaptureController() VirtualUser:ClickButton2(Vector2.new(x, y)) elseif State.MouseButton == "Middle" then VirtualUser:CaptureController() VirtualUser:ClickButton1(Vector2.new(x, y)) end end end local function StartClicking() if State.IsRunning then return end State.IsRunning = true StartButton.TextColor3 = Theme.DisabledText StartButton.Active = false StopButton.TextColor3 = Theme.LabelColor StopButton.Active = true ClickCount = 0 UpdateTitle() local intervalSeconds = State.Hours * 3600 + State.Mins * 60 + State.Secs + State.Milliseconds / 1000 if intervalSeconds <= 0 then intervalSeconds = 0.001 end local nextClick = tick() + intervalSeconds ClickConnection = RunService.Heartbeat:Connect(function() if tick() < nextClick then return end if not State.IsRunning then return end PerformClick() ClickCount += 1 if State.RepeatMode == "Repeat" and ClickCount >= State.RepeatTimes then StopClicking() return end nextClick = tick() + intervalSeconds end) end local function StopClicking() if not State.IsRunning then return end State.IsRunning = false StartButton.TextColor3 = Theme.LabelColor StartButton.Active = true StopButton.TextColor3 = Theme.DisabledText StopButton.Active = false UpdateTitle() if ClickConnection then ClickConnection:Disconnect() ClickConnection = nil end end StartButton.MouseButton1Click:Connect(StartClicking) StopButton.MouseButton1Click:Connect(StopClicking) UserInputService.InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.UserInputType ~= Enum.UserInputType.Keyboard then return end local key = input.KeyCode local matchModifier = true -- Support custom modifier check OR no modifier check if State.HotkeyModifier then local ctrl = UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) or UserInputService:IsKeyDown(Enum.KeyCode.RightControl) local shift = UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or UserInputService:IsKeyDown(Enum.KeyCode.RightShift) local alt = UserInputService:IsKeyDown(Enum.KeyCode.LeftAlt) or UserInputService:IsKeyDown(Enum.KeyCode.RightAlt) matchModifier = (State.HotkeyModifier == Enum.KeyCode.LeftControl and ctrl) or (State.HotkeyModifier == Enum.KeyCode.LeftShift and shift) or (State.HotkeyModifier == Enum.KeyCode.LeftAlt and alt) end if key == State.HotkeyKey and matchModifier then if State.IsRunning then StopClicking() else StartClicking() end end end) local HotkeyWindow = Make("Frame", { Name = "HotkeyWindow", Size = UDim2.new(0, 240, 0, 110), Position = UDim2.new(0, 80, 0, 80), BackgroundColor3 = Theme.WindowBg, BorderSizePixel = 0, Visible = false, ZIndex = 20, Active = true, Draggable = true, Parent = ScreenGui, }) Make("UICorner", { CornerRadius = UDim.new(0, 5), Parent = HotkeyWindow }) local HotkeyTitleBar = Make("Frame", { Name = "TitleBar", Size = UDim2.new(1, 0, 0, 24), BackgroundColor3 = Theme.TitleBarInactive, BorderSizePixel = 0, ZIndex = 20, Parent = HotkeyWindow, }) Make("UICorner", { CornerRadius = UDim.new(0, 5), Parent = HotkeyTitleBar }) local HotkeyTitleBottom = Make("Frame", { Size = UDim2.new(1, 0, 0, 8), Position = UDim2.new(0, 0, 1, -4), BackgroundColor3 = Theme.TitleBarInactive, BorderSizePixel = 0, Parent = HotkeyTitleBar, }) MakeLabel({ Text = "Hotkey Setting", Size = UDim2.new(1, -8, 1, 0), Position = UDim2.new(0, 6, 0, 0), TextColor3 = Theme.TitleText, TextSize = 12, Parent = HotkeyTitleBar, }) HotkeyWindow.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then HotkeyTitleBar.BackgroundColor3 = Theme.TitleBarActive HotkeyTitleBottom.BackgroundColor3 = Theme.TitleBarActive end end) MakeLabel({ Text = "Start / Stop", Position = UDim2.new(0, 8, 0, 34), Size = UDim2.new(0, 90, 0, 28), TextSize = 13, Parent = HotkeyWindow, }) local HotkeyDisplay = Make("TextButton", { Name = "HotkeyDisplay", Size = UDim2.new(0, 90, 0, 28), Position = UDim2.new(0, 140, 0, 32), BackgroundColor3 = Theme.InputBg, BorderColor3 = Theme.InputBorder, BorderSizePixel = 1, Text = State.HotkeyLabel, TextColor3 = Theme.LabelColor, TextSize = 14, Font = Enum.Font.GothamBold, ZIndex = 20, Parent = HotkeyWindow, }) Make("UICorner", { CornerRadius = UDim.new(0, 2), Parent = HotkeyDisplay }) local HotkeyOk = Make("TextButton", { Size = UDim2.new(0, 80, 0, 24), Position = UDim2.new(0, 8, 0, 76), BackgroundColor3 = Theme.ButtonBg, BorderColor3 = Theme.ButtonBorder, BorderSizePixel = 1, Text = "Ok", TextColor3 = Theme.LabelColor, TextSize = 13, Font = Enum.Font.Arial, ZIndex = 20, Parent = HotkeyWindow, }) Make("UICorner", { CornerRadius = UDim.new(0, 2), Parent = HotkeyOk }) local HotkeyCancel = Make("TextButton", { Size = UDim2.new(0, 80, 0, 24), Position = UDim2.new(0, 152, 0, 76), BackgroundColor3 = Theme.ButtonBg, BorderColor3 = Theme.ButtonBorder, BorderSizePixel = 1, Text = "Cancel", TextColor3 = Theme.LabelColor, TextSize = 13, Font = Enum.Font.Arial, ZIndex = 20, Parent = HotkeyWindow, }) Make("UICorner", { CornerRadius = UDim.new(0, 2), Parent = HotkeyCancel }) local IsListeningForHotkey = false local TempModifier = State.HotkeyModifier local TempKey = State.HotkeyKey local TempLabel = State.HotkeyLabel HotkeyDisplay.MouseButton1Click:Connect(function() if IsListeningForHotkey then return end IsListeningForHotkey = true HotkeyDisplay.Text = "..." HotkeyDisplay.TextColor3 = Theme.RadioActive local inputConnection inputConnection = UserInputService.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.Escape then IsListeningForHotkey = false HotkeyDisplay.Text = TempLabel HotkeyDisplay.TextColor3 = Theme.LabelColor inputConnection:Disconnect() return end local modifier = nil local key = input.KeyCode local label = key.Name if UserInputService:IsKeyDown(Enum.KeyCode.LeftControl) or input.KeyCode == Enum.KeyCode.LeftControl then modifier = Enum.KeyCode.LeftControl label = "CTRL+" .. (key == Enum.KeyCode.LeftControl and "..." or key.Name) elseif UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or input.KeyCode == Enum.KeyCode.LeftShift then modifier = Enum.KeyCode.LeftShift label = "SHIFT+" .. (key == Enum.KeyCode.LeftShift and "..." or key.Name) elseif UserInputService:IsKeyDown(Enum.KeyCode.LeftAlt) or input.KeyCode == Enum.KeyCode.LeftAlt then modifier = Enum.KeyCode.LeftAlt label = "ALT+" .. (key == Enum.KeyCode.LeftAlt and "..." or key.Name) end if modifier and key ~= modifier then TempModifier = modifier TempKey = key TempLabel = label HotkeyDisplay.Text = label HotkeyDisplay.TextColor3 = Theme.LabelColor IsListeningForHotkey = false inputConnection:Disconnect() elseif not modifier then -- FIX: Now allows single keystrokes without forcing CTRL mapping TempModifier = nil TempKey = key TempLabel = key.Name HotkeyDisplay.Text = TempLabel HotkeyDisplay.TextColor3 = Theme.LabelColor IsListeningForHotkey = false inputConnection:Disconnect() end end end) end) HotkeyButton.MouseButton1Click:Connect(function() HotkeyWindow.Visible = true HotkeyTitleBar.BackgroundColor3 = Theme.TitleBarActive HotkeyTitleBottom.BackgroundColor3 = Theme.TitleBarActive TempModifier = State.HotkeyModifier TempKey = State.HotkeyKey TempLabel = State.HotkeyLabel HotkeyDisplay.Text = State.HotkeyLabel HotkeyDisplay.TextColor3 = Theme.LabelColor IsListeningForHotkey = false end) HotkeyOk.MouseButton1Click:Connect(function() State.HotkeyModifier = TempModifier State.HotkeyKey = TempKey State.HotkeyLabel = TempLabel HotkeyWindow.Visible = false StartButton.Text = "Start (" .. State.HotkeyLabel .. ")" StopButton.Text = "Stop (" .. State.HotkeyLabel .. ")" end) HotkeyCancel.MouseButton1Click:Connect(function() HotkeyWindow.Visible = false TempModifier = State.HotkeyModifier TempKey = State.HotkeyKey TempLabel = State.HotkeyLabel IsListeningForHotkey = false end) for _, button in ipairs({HotkeyOk, HotkeyCancel}) do button.MouseEnter:Connect(function() button.BackgroundColor3 = Theme.ButtonHover end) button.MouseLeave:Connect(function() button.BackgroundColor3 = Theme.ButtonBg end) end RecordButton.MouseButton1Click:Connect(function() end)