Advertisement
minimic2002

Roblox Anti AutoClicker / AutoKey

Sep 11th, 2020
749
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. -------------------------------------------- // Player And Mouse
  2. local Player = game.Players.LocalPlayer
  3. local Mouse = Player:GetMouse()
  4. local SamplesToTake = 20
  5. local TimerInc = 0.05
  6.  
  7. local PeriodicResetTime = 60
  8.  
  9. -------------------------------------------- // Timer
  10. local ClickTime = 0
  11. local KeyTime = 0
  12. while true do
  13. wait(TimerInc)
  14. KeyTime = KeyTime + TimerInc
  15. ClickTime = ClickTime + TimerInc
  16. end
  17.  
  18. -------------------------------------------- // Anti Key
  19. local KeyAverage = 0
  20. local KeySampleCount = 0
  21. local KeyTotalTime = 0
  22.  
  23. Mouse.KeyUp:Connect(function(Key)
  24.  
  25. KeySampleCount = KeySampleCount + 1
  26. KeyTotalTime = KeyTotalTime + KeyTime
  27. KeyAverage = KeyTotalTime / KeySampleCount
  28. local TimeHolder = KeyTime
  29. KeyTime = 0
  30. if KeySampleCount >= SamplesToTake then
  31. if TimeHolder == KeyAverage then
  32. -- Automatic Key Pressing Detected
  33. end
  34. KeySampleCount = 0
  35. KeyTotalTime = 0
  36. KeyAverage = 0
  37. end
  38. end)
  39.  
  40. -------------------------------------------- // Anti Click
  41. local ClickAverage = 0
  42. local ClickSampleCount
  43. local ClickTotalTime = 0
  44.  
  45. Mouse.Button1Up:Connect(function()
  46. ClickSampleCount = ClickSampleCount + 1
  47. ClickTotalTime = ClickTotalTime + ClickTime
  48. ClickAverage = ClickTotalTime / ClickSampleCount
  49. local TimeHolder = ClickTime
  50. ClickTime = 0
  51. if ClickSampleCount >= SamplesToTake then
  52. if TimeHolder == ClickAverage then
  53. -- Automatic Mouse Clicking Detected
  54. end
  55. ClickSampleCount = 0
  56. ClickTotalTime = 0
  57. ClickAverage = 0
  58. end
  59. end)
  60.  
  61. -------------------------------------------- // Periodic Reset
  62. while true do
  63. wait(PeriodicResetTime)
  64. ClickSampleCount = 0
  65. ClickTotalTime = 0
  66. ClickAverage = 0
  67. KeySampleCount = 0
  68. KeyTotalTime = 0
  69. KeyAverage = 0
  70. KeyTime = 0
  71. ClickTime = 0
  72.  
  73. end
  74.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement