PlayerMouse

Show Deprecated
Not Creatable

The PlayerMouse behaves identically to the Mouse object that is obtained using Tool.Equipped. It can be accessed from LocalScripts using the local player's Player:GetMouse() method.

The only difference between the PlayerMouse and the Mouse object is the PlayerMouse can be obtained using the Player:GetMouse() method.

In most cases developers are advised to use the new UserInputService. However the PlayerMouse and Mouse objects remain supported for a number of reasons.

For more information on how to use the mouse object, see the Mouse page.

Code Samples

PlayerMouse

1local Players = game:GetService("Players")
2
3local player = Players.LocalPlayer
4
5local mouse = player:GetMouse()
6
7local function onMouseMove()
8 print("mouse screen position: ", mouse.X, mouse.Y)
9end
10
11mouse.Move:Connect(onMouseMove)

Summary

Properties

Events

Methods

Properties

Events

Methods