Skip to main content

MatchResult:getX()

Returns the X coordinate of the top-left corner of the matched region.

Description

The getX() method returns the horizontal position (X coordinate) of the top-left corner where the match was found on the screen. This value represents the pixel position from the left edge of the screen.

Signature

getX(): number

Returns

number - The X coordinate (in pixels) of the top-left corner of the matched region.

Example

local result = Screen:find("template.png")
if result then
local x = result:getX()
toast("Match found at X position: " .. x)
end