mouse1click
Dispatches a left mouse button click (press + release).
function mouse1click(): ()Synopsis
How it works
Simulates a left mouse button click (press + release) at the cursor's current screen position. Uses the Win32
SendInput API to inject hardware-level input events:
INPUT inputs[2] = {};
// Press
inputs[0].type = INPUT_MOUSE;
inputs[0].mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
// Release
inputs[1].type = INPUT_MOUSE;
inputs[1].mi.dwFlags = MOUSEEVENTF_LEFTUP;
SendInput(2, inputs, sizeof(INPUT));
Events enter the OS input queue at the same priority as physical hardware. Roblox's input pipeline cannot distinguish these from real mouse clicks. The INPUT struct is 40 bytes on x64; MOUSEINPUT.mi contains dx, dy, mouseData, dwFlags, time, and dwExtraInfo.Usage
Click
if isrbxactive() then
mouse1click()
end