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

What's a surefire way to get the mouse, when using a regular script in a tool?

Asked by 9 years ago

I try using this:

local p = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
local m = p:GetMouse()
0
You can't GetMouse can ONLY be used in a local script. M39a9am3R 3210 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

The best way to do that is to use a local script.

Have a local script in starter pack or starter Gui with the following code:

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

You can then use Mouse to get properties like Hit.

There are other ways to do this but this is one of the simpler ways.

0
I see. In the past, I've been able to actually use a localscript, then have it set an ObjectValue's value to the player's Mouse. For some reason, this no longer works. KingTheHousepet 10 — 9y
Ad

Answer this question