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

Is there a UserInputService equivalent to Mouse.Idle?

Is there a UserInputService equivalent to Mouse.Idle and if there is would you be kind enough to share with me.

1 answer

✓ Accepted answer

Unfortunately the users mouse in UserInputService is a constant event so it will not idle / have an end state.

Although you could use InputChanged to detect if the Mouse has been moved like so:

UIS = game:GetService('UserInputService')

mouseIdle = false

mouseIdleDelay = 10 -- in seconds

UIS.InputChanged:Connect(Input)
	if Input.UserInputType == Enum.UserInputType.MouseMovement then
		mouseIdle = false
	end
end)

spawn(function()
	while wait(mouseIdleDelay) do
		mouseIdle = true
	end
end)

If you have any other questions feel free to let me know.

1 comment

0

Yes I am aware of MouseMovement and I know I could just create a variable and find out when the mouse isn't moving from that but I was just hoping there was a way to do it without that. Thank you for confirming what I already thought.

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