Roblox Scritping | Auto update

Hi Everyone! So i was doing some research on

However, i was wondering. How do i get the LATEST VERSION
I want to create an auto update feature. Where when a new update comes out, each server checks if they are on the correct version, if they are not, there game shutsdown.

How would i achieve this?

1 Like

Check out this post: How to get latest Place History version?

I personally would go with the DataStore solution suggested in that thread.

How would i setup the datastore (would i make a datastore and use datastore editor to change it to the latest version and ect)

And how would the datastore look?

Try this:


local MessagingService = game:getService("MessagingService")
local DataStoreService = game:GetService("DataStoreService")
local PlaceVersionDS = DataStoreService:GetDataStore("PlaceVersion")

local PlaceVersion = game.PlaceVersion

MessagingService:SubscribeAsync("PlaceVersion", function(message)
	if message.Data > PlaceVersion then
		for i,v in pairs(game.Players:GetPlayers()) do
			v:Kick("Place version out of date")

local success, dataVersion = pcall(function()
	return PlaceVersionDS:GetAsync("PlaceVersion")
if success then
	if dataVersion then
		if dataVersion < PlaceVersion then
			PlaceVersionDS:SetAsync("PlaceVersion", PlaceVersion)
			MessagingService:PublishAsync("PlaceVersion", PlaceVersion)
		PlaceVersionDS:SetAsync("PlaceVersion", PlaceVersion)
1 Like

Thank you! Just a question, how does it work?

Edit #1: It says messaging service disconnected, is that normal?

Is your API Service enabled? I haven’t learned much about datastores, it I know you have to have api services to use them. Correct me if I’m wrong.

(sorry about my grammar errors, this autocorrect sucks lol)

It works by reading from a datastore key and automatically kicks out all players if the version is higher than the current one.

I would suggest you make a gui that tells players that an update is coming out in x seconds instead of kicking them out and updating the place, because that functionality is already done through the migrate server mechanic.

U need to be in a live server not a a studio server.

It still doesnt work. Ive tried placing it inside everwhere, idkw it isnt working.

Make sure you are not in studio

This is similar to what Introducing Migrate to Latest Update, feature does on roblox.

@cjjdawg The difference between what he wants and what the Migrate to Latest Update feature does is that he wants to automatically shutdown old servers rather than having to click the “Migrate to Latest Update” button every time he updates the game.

@TheEmeraIdDev I tested it in a live server and it worked for me. It works by saving the value of the most recent PlaceVersion in a DataStore. Then whenever a new server is created, it shuts down any existing servers with PlaceVersions less than that server’s PlaceVersion (aka old servers).

What are should i put the script in then (also, every time i attempted to update in a live server, it wouldnt work.)

Make a place with a maximum server size of 1. Then join the server, update the game in studio to change the place version, then tell a friend to join a new server. Once they join, you should be kicked from your server.

Ohhhhhhhhhhh, how do i make it work WITHOUT a player having to join then (for example, running a while true do statement)

You need two live servers to test it. You don’t need a while statement as MessagingService automatically receives a message to shutdown any time a server with a new PlaceVersion is created.

Yes, but my game isnt all that popular yet.

Is there a way i could make it check the value every 30 seconds or so?

(it not popular enough to acquire 2 full servers)

Edit #1: Realized that its better to check the servers like that.

If you want to test it out, make the game’s max players to 1 and test it on your main account on the first server, then place your alternative or have a friend on the second one.