Input
Synthesise keyboard and mouse input — press, release, click, scroll, and cursor motion — without needing the real input device.
Synthetic input, delivered at the OS level rather than through Roblox's input system. That is the important distinction: these produce events indistinguishable from a real device, but they go to whichever window has focus.
Walking forward and clicking
-- Only send input when Roblox actually has focus.
if isrbxactive() then
keypress(0x57) -- W down
task.wait(0.5)
keyrelease(0x57) -- W up
mousemoverel(100, 0) -- nudge the camera
mouse1click()
endCheck focus first
Input goes to the focused window. Without an isrbxactive() guard, a loop that presses W types into whatever you alt-tabbed to.
Three related but different questions: is the window active at all, is it the Roblox window, and is the game itself accepting input.