Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Set up auto-click variables
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- local clickInterval = 0.5 -- Time between clicks (2 clicks per second)
- local isAutoClicking = true -- You can toggle this to stop auto-clicking
- -- Target screen position to click
- local targetPosition = UDim2.new(0.5, -100, 0.5, -25)
- -- Convert UDim2 to an absolute position on the screen
- local function getScreenPosition(udim2)
- local viewportSize = game.Workspace.CurrentCamera.ViewportSize
- local x = udim2.X.Scale * viewportSize.X + udim2.X.Offset
- local y = udim2.Y.Scale * viewportSize.Y + udim2.Y.Offset
- return Vector2.new(x, y)
- end
- -- Function to simulate a mouse click at the target position
- function simulateClick()
- local screenPosition = getScreenPosition(targetPosition)
- mousemoveabs(screenPosition.X, screenPosition.Y) -- Move the mouse to the target position
- mouse1click() -- Simulate a left mouse click
- end
- -- Auto-click loop
- spawn(function()
- while isAutoClicking do
- simulateClick()
- wait(clickInterval) -- Wait 0.5 seconds between clicks
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement