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

How do I use Mouse?

Asked by
tumadrina 179
10 years ago

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?

0
Thanks tumadrina 179 — 10y

2 answers

Log in to vote
2
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

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.

0
Woah why the heck was this downvoted?! Perci1 4988 — 10y
Ad
Log in to vote
0
Answered by
Adryin 120
10 years ago

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.

Answer this question