Roblox Wiki
Advertisement
Roblox Wiki

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

  • Read-onlyThis property is capable of being read but not written.
  • Not replicatedThis member is not replicated across the network boundary.

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

  • Read-onlyThis property is capable of being read but not written.
  • Not replicatedThis member is not replicated across the network boundary.

The CFrame positioned at the current Camera light iconCamera dark iconCamera and oriented towards the Mouse's world position.

  • Category: Data.
  • Serialization: can save only.
  • Thread safety: read safe

Target: BasePart

  • Read-onlyThis property is capable of being read but not written.
  • Not replicatedThis member is not replicated across the network boundary.

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

  • Read-onlyThis property is capable of being read but not written.
  • Not replicatedThis member is not replicated across the network boundary.

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

  • Read-onlyThis property is capable of being read but not written.
  • Not replicatedThis member is not replicated across the network boundary.

A Ray that originates from the Camera light iconCamera dark iconCamera's world position directed towards the Mouse's world position.

  • Category: Data.
  • Serialization: can save only.
  • Thread safety: read safe

ViewSizeX: int

  • Read-onlyThis property is capable of being read but not written.
  • Not replicatedThis member is not replicated across the network boundary.

The window's width in absolute pixels.

  • Category: Data.
  • Serialization: can save only.
  • Thread safety: read safe

ViewSizeY: int

  • Read-onlyThis property is capable of being read but not written.
  • Not replicatedThis member is not replicated across the network boundary.

The window's height in absolute pixels.

  • Category: Data.
  • Serialization: can save only.
  • Thread safety: read safe

X: int

  • Read-onlyThis property is capable of being read but not written.
  • Not replicatedThis member is not replicated across the network boundary.

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

  • Read-onlyThis property is capable of being read but not written.
  • Not replicatedThis member is not replicated across the network boundary.

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

  • HiddenThis property is not shown in the object browser and properties window.
  • Read-onlyThis property is capable of being read but not written.
  • Not replicatedThis member is not replicated across the network boundary.
  • DeprecatedThis member will be phased out and should be avoided while it is still available.

Use Hit instead.

  • Category: Data.
  • Serialization: cannot load or save.
  • Thread safety: read safe

target: BasePart

  • Read-onlyThis property is capable of being read but not written.
  • Not replicatedThis member is not replicated across the network boundary.
  • DeprecatedThis member will be phased out and should be avoided while it is still available.

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

Button1Up()

Fires when Mouse button 1 is released.

  • Thread safety: unsafe

Button2Down()

Fires when Mouse button 2 is pressed.

  • Thread safety: unsafe

Button2Up()

Fires when Mouse button 2 is released.

  • Thread safety: unsafe

Idle()

This API member has existing documentation in this page's Member list template.
This class member is missing documentation. Create or add to its subpage at Class:Mouse/Idle.
  • Thread safety: unsafe

KeyDown(key: string)

  • DeprecatedThis member will be phased out and should be avoided while it is still available.
Parameters
NameType
keystring
  • Thread safety: unsafe

KeyUp(key: string)

  • DeprecatedThis member will be phased out and should be avoided while it is still available.
Parameters
NameType
keystring
  • Thread safety: unsafe

Move()

Fires when Mouse is moved.

  • Thread safety: unsafe

WheelBackward()

This API member has existing documentation in this page's Member list template.
This class member is missing documentation. Create or add to its subpage at Class:Mouse/WheelBackward.
  • Thread safety: unsafe

WheelForward()

This API member has existing documentation in this page's Member list template.
This class member is missing documentation. Create or add to its subpage at Class:Mouse/WheelForward.
  • Thread safety: unsafe

keyDown(key: string)

  • DeprecatedThis member will be phased out and should be avoided while it is still available.
Parameters
NameType
keystring

Use KeyDown instead.

  • Thread safety: unsafe

External links[]

Advertisement