Help with HttpRequests

Hello, I have a problem with HttpRequests.
I want to stop the HttpRequests from exceeding the limit.
My game sends a lot of HttpRequests to obtain the necessary data.
However, if there is more than one player in the server it exceeds the limit. How would I stop this?
My scripts are in StarterGui because my game is basically on a GUI.

3 Likes

You would need to send in bulk, instead of sending too many requests.
You can send up to 500 requests for the whole server each min or so.
But if you send a bulk of 30 or so, you would be way within the limit.

My game is basically a YouTube subscriber counter game. The API updates every two seconds so I send a HTTPRequest every two seconds. Basically as frequently as possible.

But I wonder is there a way to “bypass” this limit, like sending it from the server then replicating the data it needs to the clients?

I have decreased the server size to 1 to fix this issue temporarily.

How does having multiple players affect this? What kind of requests can the players send to the server(related to HTTP)?

Anyways I think the issue can be fixed by respecting the limit(so you don’t run into errors) and by implementing caching of data, queues of requests, and slowing the rate of refresh of information so the queue can’t fill up faster than it gets emptied.

Requiring that much data regardless of server-count will always be an issue. You could try loading the player’s subscriber count once they join, then just that data for the remainder of the game (store it as a variable, when sumone subscribes ingame just +1)

1 Like

Since the scripts are in StarterGui I think they might be sending seperate HttpRequests from all clients in the server which fills it up faster

But I have restricted the server sizes so I think i’m going to stick with that for now.

If you modify the server script to cache results this issue will be fixed and server size won’t have an impact. Also, it’s dangerous to allow a client to directly make HTTP requests through remotes, it allows exploiters to spam the server with HTTP requests. You should switch to the following tactic to fix those issues:

  1. The server fetches the subscriber count every x seconds and caches it.
  2. The client request to the server returns the currently cached value, it doesn’t make an http request.
1 Like

Should I store the requested data in a IntValue for example?

Also i’m not using RemoteEvents, the scripts in the StarterGui obtain the subscriber value, then store it in a IntValue. From there another script can send the value into a TextLabel

Yeah or in an array of some sort, basically a piece of information that can be retrieved when the client makes the request.

You’re using 100% either remote events or functions, unless the starter gui script is a server script itself, in that case, make it a local script that communicates with the main server script with remotes to retrieve the information so you only fetch data through http once.

Alright, I will try to attempt that soon


Also here is a screenshot of the explorer