Used to receive input from the user. Tracks mouse events and keyboard events. It is retrieved using Player:GetMouse() or passed by the Tool.Equipped event.
Properties
Hit: CFrame
The CFrame of where the Mouse ray is currently hitting a 3D object in the Workspace. If the Mouse is not over any 3D objects in the Workspace, this property is nil.
- Category: Data.
- Serialization: can save only.
- Thread safety: read safe
Icon: Content
The current Image texture of the Mouse icon.
- Category: Data.
- Serialization: can save and load.
- Thread safety: read safe
Origin: CFrame
The CFrame positioned at the current Camera and oriented towards the Mouse's world position.
- Category: Data.
- Serialization: can save only.
- Thread safety: read safe
Target: BasePart
The object in world space that the Mouse is currently pointing to. If the Mouse is not pointing to any object, this property is nil.
- Category: Data.
- Serialization: can save only.
- Thread safety: read safe
TargetFilter: Instance
When set, this object and its descendants will be ignored when determining the values of Hit and Target.
- Category: Data.
- Serialization: can save and load.
- Thread safety: read safe
TargetSurface: NormalId
When the Mouse is pointed to a BasePart, this property indicates the NormalId of that part.
- Category: Data.
- Serialization: can save only.
- Thread safety: read safe
UnitRay: Ray
A Ray that originates from the Camera's world position directed towards the Mouse's world position.
- Category: Data.
- Serialization: can save only.
- Thread safety: read safe
ViewSizeX: int
The window's width in absolute pixels.
- Category: Data.
- Serialization: can save only.
- Thread safety: read safe
ViewSizeY: int
The window's height in absolute pixels.
- Category: Data.
- Serialization: can save only.
- Thread safety: read safe
X: int
The mouse's X, or horizontal, component on the screen in absolute pixels.
- Category: Data.
- Serialization: can save only.
- Thread safety: read safe
Y: int
The mouse's Y, or vertical component on the screen in absolute pixels.
- Category: Data.
- Serialization: can save only.
- Thread safety: read safe
hit: CFrame
Use Hit instead.
- Category: Data.
- Serialization: cannot load or save.
- Thread safety: read safe
target: BasePart
Use Target instead.
- Category: Data.
- Serialization: cannot load or save.
- Thread safety: read safe
Events
Button1Down()
Fires when Mouse button 1 is pressed. Also fires from touch tap and gamepad R2.
- Thread safety: unsafe
Idle()
- Thread safety: unsafe
WheelBackward()
- Thread safety: unsafe
WheelForward()
- Thread safety: unsafe
External links[]
- Mouse in the Roblox Creator Documentation
- Mouse in the Roblox API Reference