Preface
The PlayerMouse is legacy. Roblox has for years now suggested us to move to UserInputService and ContextActionService for handling input for years now. What does this module do? Use the former.
The API is meant to give a similar feeling to the PlayerMouse, but some of the names are a little more modern.
While a lot of the code is coincidentally the same, I personally would consider this a fork of starmaq’s Custom Mouse Module since some of it ended up being based on it anyway, and again the coincidental similarities.
Properties that describe the viewport size are intentionally not present in this module due to it feeling misplaced under a mouse interface. (camera.ViewportSize
anyone?)
Why this module?
I am aware there are similar modules, but they have flaws like not cleaning up connections properly, or are unmaintained, etc.
This module aims to fix all that.
Source / Documentation
You can get the source code for this as well as the documentation:
Source
if you use roblox-ts here is the type definition file, yes i use this module in a game that uses roblox-ts and it works good
interface PlayerMouse2 {
Delta: Vector2;
Hit: CFrame;
IconEnabled: boolean;
Normal: Vector3;
Origin: CFrame;
Position: Vector2;
Sensitivity: number;
Target?: BasePart;
TargetFilter: Instance[];
UnitRay: Ray;
LeftPressed: RBXScriptSignal;
LeftClicked: RBXScriptSignal;
LeftReleased: RBXScriptSignal;
RightPressed: RBXScriptSignal;
RightClicked: RBXScriptSignal;
RightReleased: RBXScriptSignal;
Moved: RBXScriptSignal;
WheelScrolled: RBXScriptSignal;
WheelReleased: RBXScriptSignal;
WheelPressed: RBXScriptSignal;
WheelClicked: RBXScriptSignal;
}
declare const PlayerMouse2: PlayerMouse2;
export = PlayerMouse2;