MouseMoved (Event)

From Legacy Roblox Wiki
Jump to navigationJump to search
MouseMoved ( Integer x, Integer y )
Description Fired when the mouse moves or goes on top of a GUI Object.
Member of: GuiObject

Description

Event is triggered as the mouse moves over the GUI. The x, y coordinate is given in absolute coordinates relative to ScreenGui.

To get the relative location within the object:

Example
local function updateMove(x, y)
  local lx = x - obj.AbsolutePosition.x
  local ly = y - obj.AbsolutePosition.y
  -- do something relative
end
obj.MouseMoved:connect(updateMove)