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

Is there any way to detect when the mouse stops moving?

Asked by
W8X 95
8 years ago
Edited 8 years ago

Been trying to do this for a while, Mouse.Idle doesn't seem to fire if InputService.MouseBehavior is set to Enum.MouseBehavior.LockCenter, I'm not sure what else to use. Can anyone help me?

0
Actually, I think Mouse.Idle is bugged, It fires constantly regardless of whether or not the mouse is actually idle. W8X 95 — 8y

1 answer

Log in to vote
1
Answered by
cabbler 1942 Moderation Voter
8 years ago

I think you're right that Idle is broken. You could do a simple loop to replicated it though.

local idleTime = 0.5 --seconds until mouse is considered idle
local moved=false

mouse.Move:connect(function()
    moved=true
end)

spawn(function()
    while wait(idleTime) do
        if not moved then
            print('Mouse Idled')
            mouse.Move:wait()
        end
        moved=false
    end
end)
0
Thanks, man. W8X 95 — 8y
Ad

Answer this question