Hey! So I have known this for a while now but shutting down through the game page is not the BEST idea instead I have a different idea. So first off make a model with nothing in it that no-one can take with the description “v1”
while wait(60) – We put this in a while true do loop because :GetProductInfo gets the current info of the item.
local asset = game:GetService(“MarketPlaceService”):GetProductInfo(AssetIdHere)
if asset.Description == “v1” – Update this when you update the game
else
–Save Data and alert players
for i,plr in pairs(game.Players:GetPlayers()) do
plr:Kick(“The game has been updated please rejoin”)
end
end
Now what this will do is check if the products info is the current version if not then kick everyone!
So when you want to update the game and save the data simply change the description of your model and everyone will be kicked! K seeya!
Neat idea, you might be better off checking it once when the server starts then comparing against that when the game .OnClose event is triggered to make sure that you can shut down yourself without worry of people joining old servers + no need to update the script itself.
One of the problems with OnClose is that it can only be set once (I think, or setting it a second time overrode the first function, something like that). BindToClose doesn’t have that problem.
I am not really sure about this method. I originally used descriptions to store fast flags for Ultimate Boxing, until the filter decided to destroy the description and take down product sales for about 10 minutes.
What kind of limit? The 30 seconds limit? OnClose has that too.
Also, for broadcasting messages to all servers, it’d just use GlobalDataStore:OnUpdate("Broadcast",handler) and use GlobalDataStore:SetAsync("Broadcast",message) in-game or in studio with “API Access” enabled.
We have something like this in an old game I helped making. Though we use the game’s place ID as the asset ID, and check the Updated field of the returned information from GetProductInfo. All went well until players were teleported back to the server which hadn’t yet closed after the 2-minute warning, and kept teleporting forth and back to the placeholder place for when updating happened
While it might be a simple way of dealing with getting servers closed down, I don’t think kicking your playerbase is a wise choice - some of them might not like the experience and leave your game in that case.
I know. Long ago, when MarketplaceService just came out, I made a remote banlist (known as Synchronized Ban List, or SBL, which you’ll find plenty of in the Free Models) that made use of descriptions. I actually had two versions, as Roblox broke the first version after a few months:
May 02, 2013 ( 0.100.0.32485 → 0.101.0.33010 )
Changed return type of MarketplaceService.GetProductInfo from string to Dictionary
December 20, 2012 ( 0.82.0.740 → 0.83.0.754 )
Added Class MarketplaceService
Added YieldFunction MarketplaceService.GetProductInfo
I have an alternative to this that uses Roblox’s existing shutdown system. When you shutdown all servers from the website, it teleports everyone into reserved servers for a few seconds, and then teleports them back into the main game. This means you will lose fewer players and reduces the likelihood of data loss.