Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is there a better method for getting info about the mouse?

So in the past I've always just used mouse.Hit.p with "mouse" being gotten through :GetMouse() and have never had issues before. As of late though I've found myself having some odd issues where if I were to do something like fire a projectile or the like, the projectile would veer off to the left or right by a stud or two. It's especially bad when aiming at anything with a rounded or angled surface. It just seems to have a habit of occasionally registering the mouse a bit off from where it's actually pointing.

After digging around the method I'm using now is the only one I could actually find on things like forums and other issues so are there any other alternate, more precise options, or am I stuck with the slightly wonky detection? I'm also hoping to find a better alternative as there has been discussion of potentially deprecating the old mouse object after some people have been having other issues such as the mouse just altogether not connecting.

7 comments

0

You can use character's look vector if its a first person game that locks the mouse, but :GetMouse().Hit.p is the only way I know

0

Hm... I'll have to consider that when I step into first person gaming.

0

Just something that I haven't said, you can use the look vector for xy axis but you need to use mouse.Hit.p to the Y axis

0

(For a 2d game you can use just the look vector)

0

I'll keep those in mind should I decide to work on stuff like that. Actually kinda planned to work on a 2D project.

0

Maybe its possible using UserInputService... I'll check on the wiki

0

I didn't see anything on the wiki but if you find something I didn't please share.

1 answer

I think this might work. Insert a LocalScript into a tool and put this:

tool = script.Parent
handle = tool:WaitForChid("Handle")

tool.Equipped:Connect(function(m)
-- m is the player mouse
end)

2 comments

0

Not sure thouogh

0

I'm afraid that this is not what I'm looking for as I don't use tools.

This discussion is preserved as it was. New answers, comments, and votes are closed.