2024-01-31 06:33:19 +00:00
# Rate Limit <Badge type="tip" text="feature" />
2024-01-05 12:14:38 +00:00
Ratelimit is one of most useful feature.
2024-01-30 13:33:31 +00:00
( Configured on Server only and For Client )
2024-01-05 12:14:38 +00:00
## `Setup`
2024-01-30 13:33:31 +00:00
When creating a event on Server, you can add second argument (optional) as table `rateLimit` to limit the number of times the event can be called and the interval for reset the counter on client-side.
2024-01-05 12:14:38 +00:00
::: code-group
```lua [Server]
-- Server
-- Let's make the event have ratelimit with max 50 entrance for 2 seconds.
local Remote = Warp.Server("Remote1", {
2024-05-19 06:17:07 +00:00
rateLimit = {
maxEntrance = 50, -- maximum 50 fires.
interval = 2, -- 2 seconds
}
2024-01-05 12:14:38 +00:00
})
-- Now the Event RateLimit is configured, and ready to use.
-- No need anything to adds on client side.
```
```lua [Client]
-- Client
2024-01-30 13:33:31 +00:00
local Remote = Warp.Client("Remote1") -- Yields, retreive rateLimit configuration.
2024-01-05 12:14:38 +00:00
-- The Event will automatic it self for retreiving the rate limit configuration from the server.
```
:::