Skip to content

input.move

Moves the mouse cursor to a new position.

Signature

luau
function move(pos: Vector2, relative: boolean?): ()

Summary

Parameters

ParameterTypeDescription
posVector2The target coordinates.
relativeboolean?If true, moves relative to current position. Defaults to false.

Example

lua
local input = require("@runtime/input")

-- Move to absolute pixel (100, 200)
input.move(Vector2.new(100, 200))

-- Shake the mouse slightly (relative move)
input.move(Vector2.new(5, 0), true)