Mouse
Last updated
Last updated
The Mouse service allows you to get information about the current player's mouse, such as current cursor position. Note that the functionality of this service can only be used on the client.
Function
Description
GetTargetPart() -> Instance?
Retrieves the part that the mouse is currently pointing at. Returns the TargetPart
(Instance) that the mouse is hovering over.
GetTargetSurface() -> string
Retrieves the surface of the part that the mouse is currently pointing at. Returns the Surface
(Enum.SurfaceType) the mouse is hovering over.
GetPosition2D() -> number, number
Gets the 2D position of the mouse on the screen. Returns X
and Y
coordinates of the mouse.
GetPosition3D() -> Vector3
Gets the 3D position of the mouse in the game world. Returns the Position
(Vector3) where the mouse is pointing in the world.
SetTargetFilter(Object: Instance)
Sets the object to be ignored when detecting mouse target parts. Takes 1 argument: Object
(Instance), and sets it as a filter so the mouse ignores it in target detection.