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

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

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?

1 comment

0

Actually, I think Mouse.Idle is bugged, It fires constantly regardless of whether or not the mouse is actually idle.

1 answer

✓ Accepted answer

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)

1 comment

0

Thanks, man.

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