Sending a JavaScript request to roblox

I’m currently working on a project that will allow users to micromanage there games without actually being in it, I’m doing this via webpanel.

How can I go about sending data to the webpage as well as sending data to the game.


Wouldn’t this be kinda like an exploit there for making it a threat to Roblox that will be not allowed?


HttpService does not allow requests to the Roblox website.

@Faultsified I’m not talking about sending requests to the website, rather sending requests to the game.

@Strongjohnfgamer Why would this be a threat? Users install scripts in the game, it handles it all right there.

1 Like

It’s tough to send requests to your game because you have no real way of knowing where the game is located.
As far as I know, you only have simple HTTP Get & Post requests available from HttpService, so you can’t use something like a socket to send data back.

Probably the best way of doing it is a polling system - every x seconds you’d send off a request to your server, if there’s anything new it returns it in that request. Doesn’t let you get it instantly, but will let you have at least some form of communication between them.

So have some sort of table that contains all of the pending requests, every X amount of seconds the game will check them and run the pending requests?

1 Like

Yeah, exactly. So you’d periodically update it based off that; then you could be sure it’s at least accurate to within x seconds.

You’d have to poll requests for sure. You can send outgoing requests, but you can’t send them in.

Well, I know you need to use node.js for that.

Make this video in settings little bit fast.

What I’d do is when a new server starts, send a Post request to the node.js server or whatever and send the game.JobId, which is a unique GUID token representing the server instance. When the game ends, with game.BindToClose, just send another Post request with the same JobId, and then remove the GUID token from the list of tokens on the node.js server.

Then, every x seconds, the ROBLOX Server could send a get request to find any pending actions from the node.js server for the specific JobId that represents the ROBLOX server. Once they’re done, just send a Post back and specify whether or not the action was successful.

This way, although the comms wouldn’t be instantaneous, they would still exist. Be wary of exceeding the HTTP limits though.

In addition to what has been said above, servers can also use the messaging service to communicate (near) instantaneously between each other. Once any of your servers receive a message, it can relay the message (near) instantly to all the other servers.

This is exactly what I was planning on doing to catch the servers. I’ll send one request; it’ll use messagingService to get all of the servers and send the data to my website. This way users can view all running games.

A nice way to implement the polling everyone above is talking about without going over HTTP limits would be what is called “long polling”. Roblox can send a request to your remote server, but your remote server doesn’t respond immediately. Once the request times out, Roblox sends another. When the web panel actually has an action, it responds to the currently active request.

1 Like

I’m really interested in that, would you mind elaborating more?

To give you more specific details, do you know yet what type of server you’ll be working with and/or have a set a desired languages/frameworks that you’ll be using?

Basically if I wrote a test.php page like so:

<!DOCTYPE html>

    echo 'An action was fired';


Then the script would wait until the SyncEvent instance called “actionEvent” in the session state was fired. During this time the client that requested the page would be waiting for a response. Once the event is fired then php would insert “An action was fired” into the page and send off the HTML page as a response. Instead of returning an HTML page, PHP could return a JSON string with information about the action that was first fired.

Since we don’t have access to ports we can’t receive info from any other server, and even if you could you wouldn’t be able to tell which server your game is on. So, I would just recommend sending requests to your server from the Roblox game to retrieve the info.

The frontend of the website is HTML while all of my backend is JavaScript

I’m not experienced with Node, but you should be able to use something like this for your callback for get/post requests:

var requestCounter = 0;
var responses = [];

app.get('/', function (req, res) {

    requestCounter =  (requestCounter + 1) % 3
    if (requestCounter === 0) {
        responses.forEach((res) => {
            res.send("The third request was received");

The first and third requests wont receive a response until a third request is received. If you viewed it in a browser, it would look like it was loading. If you open up three browser windows and all of them navigate to there, then they will all receive a response at the same time as the third. The not responding immediately but waiting for something to happen first is long polling. You can wait until an action is received to respond, and respond with the action’s specific information.

Roblox has all methods now as far as I know

	local Success,Res = pcall(HttpService.RequestAsync,HttpService,{
		Url = "",
		Method = "GET", -- Method goes here