Version: 2.1.5
Rate limiting your remotes
Your event or AsyncFunction may perform an intensive task that you don't want players to be able to invoke every second (and possibly crash your game)
A way you can get around this is by using the Net.Middleware.RateLimit
middleware. This is a built in.
#
Limiting to a certain amount of requestsThe rate limiter middleware is created as such:
- roblox-ts
- luau
Then you pass it to a constructor for a server object, or a definition:
- roblox-ts
- luau
Object
Definition
Object
Definition
#
Custom Error HandlingWhen the rate limit is reached, it will run the error handler. By default this is set to a function which displays a warning on the server:
However, if you want to send this to something like analytics, you can provide your own error handler:
- roblox-ts
- luau
Object
Definition
Object
Definition