Advertisement
Savaloy92

Untitled

Oct 10th, 2024 (edited)
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. -- Set up auto-click variables
  2. local player = game.Players.LocalPlayer
  3. local mouse = player:GetMouse()
  4.  
  5. local clickInterval = 0.5 -- Time between clicks (2 clicks per second)
  6. local isAutoClicking = true -- You can toggle this to stop auto-clicking
  7.  
  8. -- Target screen position to click
  9. local targetPosition = UDim2.new(0.5, -100, 0.5, -25)
  10.  
  11. -- Convert UDim2 to an absolute position on the screen
  12. local function getScreenPosition(udim2)
  13. local viewportSize = game.Workspace.CurrentCamera.ViewportSize
  14. local x = udim2.X.Scale * viewportSize.X + udim2.X.Offset
  15. local y = udim2.Y.Scale * viewportSize.Y + udim2.Y.Offset
  16. return Vector2.new(x, y)
  17. end
  18.  
  19. -- Function to simulate a mouse click at the target position
  20. function simulateClick()
  21. local screenPosition = getScreenPosition(targetPosition)
  22. mousemoveabs(screenPosition.X, screenPosition.Y) -- Move the mouse to the target position
  23. mouse1click() -- Simulate a left mouse click
  24. end
  25.  
  26. -- Auto-click loop
  27. spawn(function()
  28. while isAutoClicking do
  29. simulateClick()
  30. wait(clickInterval) -- Wait 0.5 seconds between clicks
  31. end
  32. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement