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

UserInputService doesn't detect mouse movement? [closed]

Asked by 7 years ago
Edited 7 years ago

This has been an issue for me for quite some time now. Initially, I was unsure if this was ROBLOX's fault or my fault. But after waiting this long I'm just not sure anymore...

Here's a seemingly viable example of checking for mouse movement with UserInputService. I'm not sure if I'm missing something here, or if this has just been a thing with ROBLOX forever:

local inputService = game:GetService("UserInputService")

inputService.InputBegan:connect(function(input)
    print(input) -- Not even the MouseMovement input type shows.
end)

Nothing prints when the mouse is moved. I feel like I'm probably just missing something, but at the same time I see nothing wrong with this, for there's a UserInputType called MouseMovement. So, if anyone has any insight on this I'd appreciate it.


Edit:

It also doesn't detect any of the following UserInputTypes (including MouseMovement):

  • MouseWheel

  • TextInput

Locked by JesseSong

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

2 answers

Log in to vote
4
Answered by 7 years ago

The users mouse is a constant event so it will not end / have an end state.

You are able to use the 'InputChanged' event to find when the mouse is moved:-

local inputService = game:GetService("UserInputService")
local mouse = game.Players.LocalPlayer:GetMouse()

inputService.InputChanged:connect(function(input)
   print('inServ', input.UserInputType, input.Position,'mouse' ,mouse.X, mouse.Y)
end)

Hope this helps

Ad
Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

I found that both MouseMovementand MouseWheel can be detected using InputChanged rather than InputBegan. I'm not sure about TextInput however.

0
Thanks. ScriptGuider 5640 — 7y