Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local userInputService = game:GetService("UserInputService")
- local virtualUser = game:GetService("VirtualUser")
- local AfkEnabled = false
- local timeInAfk = 0
- local screenGui = Instance.new("ScreenGui")
- screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- screenGui.ResetOnSpawn = false
- local mainFrame = Instance.new("Frame")
- mainFrame.Parent = screenGui
- mainFrame.Size = UDim2.new(0, 300, 0, 50)
- mainFrame.Position = UDim2.new(0.5, -150, 0.1, -60)
- mainFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 30)
- mainFrame.BorderSizePixel = 0
- mainFrame.AnchorPoint = Vector2.new(0.5, 0.5)
- mainFrame.Visible = true
- mainFrame.Active = true
- mainFrame.Draggable = true
- local mainFrameCorner = Instance.new("UICorner")
- mainFrameCorner.CornerRadius = UDim.new(0, 10)
- mainFrameCorner.Parent = mainFrame
- local timeLabel = Instance.new("TextLabel")
- timeLabel.Parent = mainFrame
- timeLabel.Size = UDim2.new(0.6, 0, 1, 0)
- timeLabel.Position = UDim2.new(0.2, 0, 0, 0)
- timeLabel.BackgroundTransparency = 1
- timeLabel.Text = "0s 0m 0h"
- timeLabel.TextColor3 = Color3.fromRGB(200, 200, 255)
- timeLabel.TextScaled = true
- timeLabel.Font = Enum.Font.FredokaOne
- timeLabel.TextStrokeTransparency = 0.8
- local playIcon = Instance.new("TextButton")
- playIcon.Parent = mainFrame
- playIcon.Size = UDim2.new(0.2, 0, 1, 0)
- playIcon.Position = UDim2.new(0.8, 0, 0, 0)
- playIcon.BackgroundColor3 = Color3.fromRGB(100, 100, 255)
- playIcon.Text = "▶"
- playIcon.TextColor3 = Color3.fromRGB(255, 255, 255)
- playIcon.TextScaled = true
- playIcon.BorderSizePixel = 0
- local stopIcon = Instance.new("TextButton")
- stopIcon.Parent = mainFrame
- stopIcon.Size = UDim2.new(0.2, 0, 1, 0)
- stopIcon.Position = UDim2.new(0.8, 0, 0, 0)
- stopIcon.BackgroundColor3 = Color3.fromRGB(100, 100, 255)
- stopIcon.Text = "■"
- stopIcon.TextColor3 = Color3.fromRGB(255, 255, 255)
- stopIcon.TextScaled = true
- stopIcon.BorderSizePixel = 0
- stopIcon.Visible = false
- local IconBoxCorner = Instance.new("UICorner")
- IconBoxCorner.CornerRadius = UDim.new(0, 10)
- IconBoxCorner.Parent = playIcon
- local IconBox2Corner = Instance.new("UICorner")
- IconBox2Corner.CornerRadius = UDim.new(0, 10)
- IconBox2Corner.Parent = stopIcon
- local destroyButton = Instance.new("TextButton")
- destroyButton.Parent = mainFrame
- destroyButton.Size = UDim2.new(0.2, 0, 1, 0)
- destroyButton.Position = UDim2.new(0, 0, 0, 0)
- destroyButton.BackgroundColor3 = Color3.fromRGB(100, 100, 255)
- destroyButton.Text = "X"
- destroyButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- destroyButton.TextScaled = true
- destroyButton.Font = Enum.Font.FredokaOne
- destroyButton.BorderSizePixel = 0
- local destroyButtonCorner = Instance.new("UICorner")
- destroyButtonCorner.CornerRadius = UDim.new(0, 10)
- destroyButtonCorner.Parent = destroyButton
- destroyButton.MouseButton1Click:Connect(function()
- mainFrame.Visible = false
- end)
- local function formatAfkTime(seconds)
- local hours = math.floor(seconds / 3600)
- local minutes = math.floor((seconds % 3600) / 60)
- local remainingSeconds = seconds % 60
- return tostring(remainingSeconds) .. "s " .. tostring(minutes) .. "m " .. tostring(hours) .. "h"
- end
- local function afkTimer()
- spawn(function()
- while AfkEnabled do
- wait(1)
- timeInAfk = timeInAfk + 1
- timeLabel.Text = formatAfkTime(timeInAfk)
- end
- end)
- end
- local function startAfk()
- spawn(function()
- while AfkEnabled do
- wait(60)
- virtualUser:CaptureController()
- virtualUser:ClickButton2(Vector2.new())
- end
- end)
- end
- playIcon.MouseButton1Click:Connect(function()
- AfkEnabled = true
- playIcon.Visible = false
- stopIcon.Visible = true
- startAfk()
- afkTimer()
- end)
- stopIcon.MouseButton1Click:Connect(function()
- AfkEnabled = false
- timeInAfk = 0
- timeLabel.Text = "0s 0m 0h"
- playIcon.Visible = true
- stopIcon.Visible = false
- end)
Add Comment
Please, Sign In to add comment