[Release] Mouse Module V2

Ca you Maybe show footage of it being used
For the people who dont want to read the whole thing

Good model though

2 Likes

Good idea, I’ll make sure to add an example.

Could you provide more insight into what usage, features, or direct advantages this provides over the vanilla Mouse?

The Mouse object of player:GetMouse() is not supposed to be used in new work. This module makes use of UserInputService to simulate the Mouse object without actually using it. I’ve also added some documentation.

1 Like

If you want a module that has no backwards compatibility with the original Mouse object. But is simpler to use than UserInputService, you can give my other module a try:

I don’t really see a use for this. If people really wanted, they could just use ContextActionService/UserInputService to ‘recreate’ the Mouse instance, especially if it’s supposed to be a recreation of a deprecated class… I find it simpler to do so in those services, anyways.

4 Likes

Yeah, for most people it might be useless. It was made cuz quite a number of people used my old module, but since it was broken I decided to release a second version.

Unrelated but can someone tell me what “color: Color3, temporary: boolean” means. Like what are the “: Color3 and : boolean” for.

So, this is apart of roblox’s LuaU language. Basically these are called “types” and can help you with scripting, example provided below. This reference uses --!strict

--!strict 
local function Test(arg1: string)
    print(arg1)
end

Test("Hello World!") -- This returns "Hello World!" in the console
Test(workspace) -- This returns nothing since it won't run due to "workspace" being an instance/service

This example isn’t perfect although hopefully you understand a bit more!

1 Like

The download seems to be broken at the moment, once I get back to my pc I hope to fix it.

EDIT: Should be fixed!

Mouse.Hit it changes only when the player moves the mouse, but when the player turns the camera without moving the mouse, Mouse.Hit remains unchanged, I propose to make it so that when the camera changes its position, the Mouse.Hit also changed or BindToRenderStepped in case something appears in front of the camera

2 Likes

Good suggestion, didn’t realize that. If I have time I’ll add it tomorrow.

Oh so you don’t get warned for unrelated topic and i do? great!

Hey! How would I set a TargetFilter with this?

you can access the target filters using TargetFilters property.
That property has these methods to change the filter:

-- Adds a new instance to the list of instances the raycast ignores
mouse.TargetFilters:Add(descendant: Instance): nil

-- Sets the list of instances which will be ignored by the raycast
mouse.TargetFilters:Set(instances: {Instance}): nil

I noticed that mouse.Hit returns nothing if clicking into the sky. Which makes sense but the normal mouse.Hit will typically return a value that is just very far away. Is there a work around for this built in to the module?

I modified the code, it should now behave that way.

Hi there,can the module use on serversided?Thank you.

You cannot use a client-based module for something like the player’s mouse, on the server

1 Like

Is there a way to keep the same mouse.Hit locked if a mobile player clicks a gui button?