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

How do I use Mouse?

I'm not sure How I would use Mouse for example, DO I do

LocalPlayer.Mouse.Move:connect(function)--[[?]]

or do I just use

Mouse.connect(function)--[[?]]

and also, do I use it in a scrip or localscript?

1 comment

0

Thanks

2 answers

✓ Accepted answer

To get the mouse, you must do game.Players.LocalPlayer:GetMouse() from a local script. To use an anonymous function for the Move event, you do this:

local mouse = game.Players.LocalPlayer:GetMouse()

mouse.Move:connect(function()
	--code
end)

Also, make sure the LocalScript is in PlayerGui or Backpack.

1 comment

0

Woah why the heck was this downvoted?!

I would do this in a local script:

mouse = game.Players.localPlayer:GetMouse()
mouse.Moved:connect(function()
print("Mouse moved")
--Do what you want here.
end

to get the mouse.

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