Firing remote events frequently...Is this bad?

Hey, so I am using the UserInputService.WindowFocusRelease to make an AFK system.

I will be firing a remote event to the server every time the player tabs in/out, I know that firing events too frequently is bad, but I dont know if there are any alternatives, if you have any, please let me know.

Client script:

UserInputService.WindowFocusReleased:Connect(function()
	print('Tabbed out')
end)

UserInputService.WindowFocused:Connect(function()
	print('Tabbed in')
end)
1 Like

not really any alternatives but you could add in a function to prevent someone spam tabbing in and out to mess with the events (basically a debounce ig)

4 Likes

You should avoid firing more than ~20 remote events per second, though I believe how much data is being sent is another factor.

My recommendation would be to add a delay. So instead of them going AFK instantly, possibly make them go AFK if they are tabbed out for 5 seconds+? Same thign with the window focused. What you could do is require an input event to undo the AFK.

To answer your question, theoretically unless abused the remote events wouldn’t be too much of an issue.

Not only to save server ram, I would highly recommend adding a delay for practical use.

I appreciate all of the replies, I added a debounce to prevent the event from firing too much. Thank you