Script to make the game know that it is updating

Hello Developers! I would like to create a script that knows when the game is updating even though it is still running mid game. For example: The game updates and everyone would get this Gui that " The game updates, please rejoin to save all the stats! ". I am trying to do this for smooth interaction with players not just kicking them by shutting the server down. Any help is appreciated! Thank you!

3 Likes

BindToClose() i guess

4 Likes

BindToClose runs when the server is about to shutdown. What I am trying to do is a script that let the players know that the game is updated to the latest.

3 Likes

Periodic check if the game info? Keep checking every minute or so if the games updated time is different from marketplace info

4 Likes

Either do what @hya123456h suggested, or you could just update the game, join a server, have a command for updating, which just sends a request to each server using MessagingService, for example store the version of the current server in the game, send the new version with MessagingService, then check if the new version isn’t equal to the current server version, if not, create gui, and teleport every player to a new server within that game (the new server has to be empty), but if you are going for automatic updates, once again: do what @hya123456h suggested.

3 Likes

I already did this but the number is not changing even though I updated the game.

3 Likes

Using the MessagingService provided is the optimal solution for you.

3 Likes

I know about messaging service and how it communicates between servers. Why would this be useful for knowing that the game has updated?

2 Likes

What I want is for the game to detect updates, and not for me to join the game and enter commands

2 Likes

ServerScript in ServerScriptService

local Version1 = game:GetService("MarketplaceService"):GetProductInfo(game.PlaceId).Updated

task.spawn(function()
	while true do 
		local NewVersion = game:GetService("MarketplaceService"):GetProductInfo(game.PlaceId).Updated
		if NewVersion ~= Version1 then 
			warn("Not Updated Server")
		else 
			print("Updated Server")
		end
		task.wait(1)
	end
end)
2 Likes

Well you said that GetProductInfo.Updated doesn’t change for you (which is highly unlikely), therefore you cannot detect it automatically.

2 Likes

I used this but the numbers doesnt change even thought I already updated the game.

2 Likes

What do you mean by numbers?
and you can still try teleporting the players to new game which is updated.

2 Likes

The “.Updated” returns timestamp and it is on the loop which prints it. It is not changing even though the game is updated.

2 Likes

What about a new game, did you try that?

2 Likes

Where I am editing is in a blank new baseplate

2 Likes

``local marketplaceservice = game:GetService(“MarketplaceService”)
local players = game.Players
local runservice = game:GetService(“RunService”)
local updated = false
local your_experience_id = 17018719096
local insertservice = game:GetService(“InsertService”)

runservice.Stepped:Connect(function()
task.wait(2)

local updated_version = marketplaceservice:GetProductInfo(game.PlaceId).Updated

print(updated_version)

end)

2 Likes

I meant by new game, is the game you get teleported to after the game is updated

2 Likes

image

This is what I mean. It is still returning the same timestamp even though I updated the game.

2 Likes

It detects the timestamp of the current update, the changes cannot be applied while you are in game, so the timestamp doesn’t update. when you rejoin it will update.

2 Likes