We use cookies on this site to enhance your user experience



The Mouse object is the code interface for the computer mouse.

How to get the Mouse?

A Mouse object is not createable, but can be obtained using the Player/GetMouse, Tool/Equipped. The PluginMouse object, which inherits from Mouse can be created using the Plugin Plugin/GetMouse function.

local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer -- from a LocalScript
local mouse = Player:GetMouse()
	-- got mouse

Mouse alternatives

There is a degree of overlap between the functionality offered by ContextActionService, UserInputService and the Mouse object.

Mouse, by and large, has been superseded by UserInputService which offers wider additional functionality for interacting with the mouse as well as other input types. For example:

  • UserInputService supports other inputs such as key presses and mobile inputs whereas Mouse does not
  • UserInputService includes additional mouse features such as UserInputService/MouseBehavior and UserInputService/MouseDeltaSensitivity

In most cases developers are advised to use the new UserInputService. However the Mouse object remains supported for a number of reasons.

  • Mouse existed long before UserInputService and a large number of places and gear items are dependent on it
  • The PluginMouse object is still used by plugins accessing the mouse
  • The mouse object is embedded into Tools and is easier to pick up for new developers


Name Type Description



The DataType/CFrame of the mouse’s position in 3D space.


The content ID of the image used as the Mouse's icon.


A DataType/CFrame positioned at the Workspace/CurrentCamera and oriented toward the Mouse's 3D position.


The object in 3D space the mouse is pointing to.


If set, the TargetFilter and its descendants will be ignored by the mouse when determining Mouse/Hit and Mouse/Target.


Returns the Enum/NormalId of the BasePart surface the mouse is pointing to.


A DataType/Ray starting at the position of the player’s Workspace/CurrentCamera and travelling towards the Mouse's position in 3D space


Represents the width of the game window in pixels.


Represents the height of the game window in pixels.



The X component of the mouse’s position on the screen.



The Y component of the mouse’s position on the screen.

Inherited from Instance

Archivable ClassName DataCost Name Parent RobloxLocked


Name Type Description

Fired when the left mouse button is pressed.

For information on how to obtain the Mouse object, please see the Mouse page.

Developers can find out the position of the mouse in world-space, and if it is pointing at any BasePart, using the Mouse/Hit and Mouse/Target properties.

Note, developers are recommended to use UserInputService instead of the Mouse object in new work.

Fires when the left mouse button is released.

Fires when the right mouse button is pressed.

Fired when the right mouse button is released.

Fired during every heartbeat that the mouse isn’t being passed to another mouse event.

Fired when the mouse is moved.

Fires when the mouse wheel is scrolled backwards.

Fires when the mouse wheel is scrolled forwards.

Inherited from Instance

AncestryChanged Changed ChildAdded ChildRemoved DescendantAdded DescendantRemoving