MaxproGlitcher

Anti AFK TESt 1

Oct 31st, 2024
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.50 KB | None | 0 0
  1. local userInputService = game:GetService("UserInputService")
  2. local virtualUser = game:GetService("VirtualUser")
  3. local antiAfkEnabled = false
  4. local timeInAfk = 0
  5.  
  6. local screenGui = Instance.new("ScreenGui")
  7. screenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  8. screenGui.ResetOnSpawn = false
  9.  
  10. local menuFrame = Instance.new("Frame")
  11. menuFrame.Parent = screenGui
  12. menuFrame.Size = UDim2.new(0, 300, 0, 200)
  13. menuFrame.Position = UDim2.new(0.5, -150, 0.5, -100)
  14. menuFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 30)
  15. menuFrame.BorderSizePixel = 0
  16. menuFrame.AnchorPoint = Vector2.new(0.5, 0.5)
  17. menuFrame.Visible = true
  18. menuFrame.Active = true
  19. menuFrame.Draggable = true
  20.  
  21. local corner = Instance.new("UICorner")
  22. corner.CornerRadius = UDim.new(0, 6)
  23. corner.Parent = menuFrame
  24.  
  25. local titleLabel = Instance.new("TextLabel")
  26. titleLabel.Parent = menuFrame
  27. titleLabel.Size = UDim2.new(1, 0, 0, 40)
  28. titleLabel.Position = UDim2.new(0, 0, 0, 0)
  29. titleLabel.BackgroundTransparency = 1
  30. titleLabel.Text = "Anti AFK"
  31. titleLabel.TextColor3 = Color3.fromRGB(200, 200, 255)
  32. titleLabel.TextScaled = true
  33. titleLabel.Font = Enum.Font.FredokaOne
  34. titleLabel.TextStrokeTransparency = 0.8
  35. titleLabel.ZIndex = 2
  36.  
  37. local sLine = Instance.new("Frame")
  38. sLine.Parent = menuFrame
  39. sLine.Size = UDim2.new(1, 0, 0, 2)
  40. sLine.Position = UDim2.new(0, 0, 0, 40)
  41. sLine.BackgroundColor3 = Color3.fromRGB(100, 100, 255)
  42. sLine.ZIndex = 2
  43.  
  44. local antiAfkButton = Instance.new("TextButton")
  45. antiAfkButton.Parent = menuFrame
  46. antiAfkButton.Size = UDim2.new(0, 180, 0, 40)
  47. antiAfkButton.Position = UDim2.new(0.5, -90, 0.4, -20)
  48. antiAfkButton.BackgroundColor3 = Color3.fromRGB(100, 100, 255)
  49. antiAfkButton.Text = "Anti AFK: OFF"
  50. antiAfkButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  51. antiAfkButton.TextScaled = true
  52. antiAfkButton.Font = Enum.Font.FredokaOne
  53. antiAfkButton.BorderSizePixel = 0
  54. antiAfkButton.ZIndex = 2
  55.  
  56. local antiAfkCorner = Instance.new("UICorner")
  57. antiAfkCorner.CornerRadius = UDim.new(0, 6)
  58. antiAfkCorner.Parent = antiAfkButton
  59.  
  60. local afkTimerLabel = Instance.new("TextLabel")
  61. afkTimerLabel.Parent = menuFrame
  62. afkTimerLabel.Size = UDim2.new(1, 0, 0, 30)
  63. afkTimerLabel.Position = UDim2.new(0, 0, 0.7, -30)
  64. afkTimerLabel.BackgroundTransparency = 1
  65. afkTimerLabel.Text = "AFK Time"
  66. afkTimerLabel.TextColor3 = Color3.fromRGB(200, 200, 255)
  67. afkTimerLabel.TextScaled = true
  68. afkTimerLabel.Font = Enum.Font.FredokaOne
  69. afkTimerLabel.TextStrokeTransparency = 0.8
  70. afkTimerLabel.ZIndex = 2
  71.  
  72. local timeDisplayLabel = Instance.new("TextLabel")
  73. timeDisplayLabel.Parent = menuFrame
  74. timeDisplayLabel.Size = UDim2.new(1, 0, 0, 30)
  75. timeDisplayLabel.Position = UDim2.new(0, 0, 0.8, -10)
  76. timeDisplayLabel.BackgroundTransparency = 1
  77. timeDisplayLabel.Text = "0s 0m 0h"
  78. timeDisplayLabel.TextColor3 = Color3.fromRGB(200, 200, 255)
  79. timeDisplayLabel.TextScaled = true
  80. timeDisplayLabel.Font = Enum.Font.FredokaOne
  81. timeDisplayLabel.TextStrokeTransparency = 0.8
  82. timeDisplayLabel.ZIndex = 2
  83.  
  84. local function formatAfkTime(seconds)
  85. local hours = math.floor(seconds / 3600)
  86. local minutes = math.floor((seconds % 3600) / 60)
  87. local remainingSeconds = seconds % 60
  88. return tostring(remainingSeconds) .. "s " .. tostring(minutes) .. "m " .. tostring(hours) .. "h"
  89. end
  90.  
  91. local function startAfkTimer()
  92. spawn(function()
  93. while antiAfkEnabled do
  94. wait(1)
  95. timeInAfk = timeInAfk + 1
  96. timeDisplayLabel.Text = formatAfkTime(timeInAfk)
  97. end
  98. end)
  99. end
  100.  
  101. local function startAntiAfk()
  102. spawn(function()
  103. while antiAfkEnabled do
  104. wait(60)
  105. virtualUser:CaptureController()
  106. virtualUser:ClickButton2(Vector2.new())
  107. end
  108. end)
  109. end
  110.  
  111. antiAfkButton.MouseButton1Click:Connect(function()
  112. antiAfkEnabled = not antiAfkEnabled
  113. if antiAfkEnabled then
  114. antiAfkButton.Text = "Anti AFK: ON"
  115. startAntiAfk()
  116. startAfkTimer()
  117. else
  118. antiAfkButton.Text = "Anti AFK: OFF"
  119. timeInAfk = 0
  120. timeDisplayLabel.Text = "0s 0m 0h"
  121. end
  122. end)
  123.  
  124. local Cbutton = Instance.new("TextButton")
  125. Cbutton.Parent = menuFrame
  126. Cbutton.Size = UDim2.new(0, 30, 0, 30)
  127. Cbutton.Position = UDim2.new(1, -35, 0, 5)
  128. Cbutton.BackgroundTransparency = 1
  129. Cbutton.Text = "X"
  130. Cbutton.TextColor3 = Color3.fromRGB(100, 100, 255)
  131. Cbutton.TextScaled = true
  132. Cbutton.Font = Enum.Font.FredokaOne
  133. Cbutton.BorderSizePixel = 0
  134. Cbutton.ZIndex = 3
  135.  
  136. Cbutton.MouseButton1Click:Connect(function()
  137. menuFrame.Visible = false
  138. end)
Add Comment
Please, Sign In to add comment