MouseEnter (Event)/2D

From Legacy Roblox Wiki
Jump to navigationJump to search
MouseEnter ( int x, int y )
Description Fired when the mouse enters a GuiObject, as long as the GuiObject is active (see active property for more detail). Arguments x, and y specify the absolute pixel position of the mouse.
Member of: GuiObject


Example

This code, which assumes that the GuiObject variable refers to a GuiObject, would print the coordinates where the mouse entered a GuiObject whenever it did:

GuiObject.MouseEnter:connect(function(x, y)
	print("The user's mouse cursor has entered the GuiObject at position (" .. x .. ", " .. y .. ").)"
end)