Advertisement
NeverScriptBeLike

new

Oct 19th, 2023
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. getgenv().Settings = {
  2. ["Auto Click Keybind"] = "C", -- Use an UpperCase letter or KeyCode Enum. Ex: Enum.KeyCode.Semicolon
  3. ["Lock Mouse Position Keybind"] = "B",
  4. ["Right Click"] = false,
  5. ["GUI"] = true, -- A drawing gui that tells you what is going on with the autoclicker.
  6. ["Delay"] = 0 -- 0 for RenderStepped, other numbers go to regular wait timings.
  7. }
  8. --Already Running--
  9. if getgenv()["Already Running"] then return else getgenv()["Already Running"] = "" end
  10. --Services--
  11. local UIS = game:GetService("UserInputService")
  12. local VIM = game:GetService("VirtualInputManager")
  13. local Players = game:GetService("Players")
  14. local RunService = game:GetService("RunService")
  15. --Vars--
  16. local LocalPlayer = Players.LocalPlayer
  17. local Camera = workspace.CurrentCamera
  18. local flags = {Auto_Clicking = false, Mouse_Locked = false}
  19. --Mouse--
  20. local Mouse = setmetatable({}, {
  21. __index = function(table, index)
  22. return UIS:GetMouseLocation()[index]
  23. end
  24. })
  25. --Get Keybind--
  26. local getKeycode = function(bind)
  27. return (pcall(function() return (Enum.KeyCode[bind]) end) and Enum.KeyCode[bind] or bind)
  28. end
  29. --Draw--
  30. local Draw = function(obj, props)
  31. local NewObj = Drawing.new(obj)
  32.  
  33. for i, v in next, props do
  34. NewObj[i] = v
  35. end
  36.  
  37. return NewObj
  38. end
  39. --Create GUI--
  40. local Text = Draw("Text", {
  41. Size = 18,
  42. Outline = true,
  43. OutlineColor = Color3.fromRGB(255, 255, 255),
  44. Color = Color3.fromRGB(0, 0, 0),
  45. Text = "Auto Clicking : FALSE\nMouse Locked : FALSE",
  46. Visible = true,
  47. })
  48. --Key Bind--
  49. UIS.InputBegan:Connect(function(inputObj, GPE)
  50. if (not GPE) then
  51. if (inputObj.KeyCode == getKeycode(Settings["Auto Click Keybind"])) then
  52. flags.Auto_Clicking = not flags.Auto_Clicking
  53. end
  54.  
  55. if (inputObj.KeyCode == getKeycode(Settings["Lock Mouse Position Keybind"])) then
  56. flags.Mouse_Locked_Position = Vector2.new(Mouse.X, Mouse.Y)
  57. flags.Mouse_Locked = not flags.Mouse_Locked
  58. end
  59.  
  60. Text.Text = ("Auto Clicking : %s\nMouse Locked : %s"):format(tostring(flags.Auto_Clicking):upper(), tostring(flags.Mouse_Locked):upper())
  61. end
  62. end)
  63. --Auto Click--
  64. coroutine.wrap(function()
  65. while (true) do
  66. Text.Visible = Settings.GUI
  67. Text.Position = Vector2.new(Camera.ViewportSize.X - 133, Camera.ViewportSize.Y - 48)
  68.  
  69. if (flags.Auto_Clicking) then
  70. for i = 1, 2 do
  71. if (flags.Mouse_Locked) then
  72. VIM:SendMouseButtonEvent(flags.Mouse_Locked_Position.X, flags.Mouse_Locked_Position.Y, Settings["Right Click"] and 1 or 0, i == 1, nil, 0)
  73. else
  74. VIM:SendMouseButtonEvent(Mouse.X, Mouse.Y, Settings["Right Click"] and 1 or 0, i == 1, nil, 0)
  75. end
  76. end
  77. end
  78.  
  79. if (Settings.Delay <= 0) then
  80. RunService.RenderStepped:Wait()
  81. else
  82. wait(Settings.Delay)
  83. end
  84. end
  85. end)()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement