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

How to target Mouse without using a function?

I'm trying to target the Mouse object and (due to the wiki being in the middle of API renovations) the only way I could find to target the mouse was with this:

script.Parent.Equipped:connect(function(mouse)
	mouse.Button1Down:connect(function()

Now I was wondering if there is a way to target straight to the mouse without having to go through all that function mumbo-jumbo. Is there a hierarchy to get to it, or do you have to use a function?

1 answer

✓ Accepted answer

Yes, here's how you do it:

mouse = game.Players.LocalPlayer:GetMouse()

GetMouse() returns a mouse object, which you can use like normal. Running this in any local script will work; it does not have to be in a tool or hopperbin.

1 comment

1

Keep in mind that this comes with one caveat: you can't set the mouse icon using the PlayerMouse object returned by GetMouse, you still have to use a Tool or Hopperbin to do that.

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