Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 5 years ago

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.

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 Leamir 3138 — 5y
0
Hm... I'll have to consider that when I step into first person gaming. XxTrueDemonxX 362 — 5y
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 Leamir 3138 — 5y
0
(For a 2d game you can use just the look vector) Leamir 3138 — 5y
View all comments (3 more)
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. XxTrueDemonxX 362 — 5y
0
Maybe its possible using UserInputService... I'll check on the wiki Leamir 3138 — 5y
0
I didn't see anything on the wiki but if you find something I didn't please share. XxTrueDemonxX 362 — 5y

1 answer

Log in to vote
0
Answered by
Geobloxia 251 Moderation Voter
5 years ago

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)
0
Not sure thouogh Geobloxia 251 — 5y
0
I'm afraid that this is not what I'm looking for as I don't use tools. XxTrueDemonxX 362 — 5y
Ad

Answer this question