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

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

I try using this:

local p = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
local m = p:GetMouse()

1 comment

0

You can't GetMouse can ONLY be used in a local script.

1 answer

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.

1 comment

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.

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