Hi! I’m developing a place analyzer program called Yarbo. This program will be able to get basic statistics (visitors, servers, etc…). But if the user adds the YarboLoader which I’m developing. Everytime someone joins the game the Module need to send the player name and profile Id to a webserver. I already have the webserver I just need to know how to send data from the game to the webserver (and then storing it). I would appreciate if you can write the webserver code in JS so it’s more easier for me to understand.
The goal that I want to achieve:Begin able to send data from the roblox game directly to a webserver and then storing it. Begin able to get the data from the webserver and displaying it.
Then on the web server side, save that data into the database.
Loading data is the reverse. Make a GET request from the game, load the correct key from the database, send it back.
See how far you can get and then come back with more specific questions ;). This forum is not the best for asking about JavaScript though. There are lots of tutorials online.
First of all thanks for the answer. Yes I’m using NodeJS but could you be more specific on how would I save the data? Like what url should I put in the HttpService:PostAsync() function? And another question.
Well, you’d need to host your web server somehow, and then the URL is just the URL of your web server.
If you’re just running your game in studio and testing, you could listen on port 3000 or something (google “how to handle POST request with express” or something) and then do
Then the “localhost” in the URL becomes the public IP of your computer.
The key in whatever database you go with. This is like a key in a DataStore on Roblox.
You gotta pick a database first and figure out how to create one, then how to connect to one through NodeJS.
MongoDB seems popular, but I’m not an expert on it. Google around for some tutorials on MongoDB.
This one seems fine for creating the database locally, and this one tells you how to connect to it from node.
There’s also a bunch of stuff and tutorials about “mongo atlas” or something out there, which is some cloud hosted database I guess. Maybe you want to use it for yours, up to you.