Question about API/HTTP service

I’m having a little bit of trouble trying to figure out if I am correct or not so I was wondering if anybody could help explain it to me.

1.) If I want to update a game or insert data into my game while the game has players playing, I would need to use httpservice and a basic pastebin? This would apply to things like bools, tables, strings, etc. Objects as well?

2.) If I want to add new data to my pastetbin, the data will update over automatically without me having the check it??

I start by loading into the server where a script will contact the httpservice and get my pastebin. That will be where I have my data saved. the player will then receive the data they need and then the game will go on…

You can’t update a live game, no matter what. I recommend you use merely’s soft shutdown. Its something that allows you to shut down a game, but redirected them to a new server so it’ll have the new updates. While keeping them inside the game
Link: Soft Shutdown Script

I am talking more about updating information like leaderboards and such live in game

Oh, just use datastore’s to update it. Nothing complex, follow this tutorial

It’ll auto update, no matter their server,

That can work. A raw paste on pastebin can allow you to obtain and receive from your game through external means, if you create the paste on a registered account. Writing the data in the paste in JSON format would be the best, then when you want to receive the data in a game, then you can use RequestAsync and then use JSONDecode to transform the JSON string into a Lua table where you can easily pull information.

With objects/instances, those would require serialisation of the data meaning that you need to store the data in a form that can be saved in a pastebin post with the class name as well as the necessary property settings and then construct the desired object with the necessary properties set – a process known as deserialisation, which are two procedures often used in datastores too.

As for changing the data and reapplying in the game servers, that wouldn’t just work with one request. You need periodic requests where you send a request to your paste ever so often. Keep in mind that game servers have a limit of 500 HTTP req/min, which means at most, you can send 8 requests per second (480 req/min), but you should consider how often you actually want the data to change in the game servers and how often you change the data in the paste.

Hopefully this gives you some insight

1 Like

In addition to the above comments, Memory Store Service is helpful for short term data that you change quickly. Data Store Service is usually better for longer term data.

1 Like

You can definitely use API Service and either DataStores / MemoryStores or the HttpService as you mentioned. There are some interesting use-cases for live updates. Although when it comes down to scripts, you’ll probably have to code your game with updating assets and modularity in mind.

But as @luisgamercooI231fan mentioned, using a shoft shutdown system would be the easiest.

You can also just use ModuleScripts and LoadAsset I think it was, to load the latest version? You can also check the version if it’s updated as an asset using the MarketPlaceService (GetProductInfo).