Hello! I am wondering how to automaticaly update servers. What I mean is that running servers in the Game also update when the game is updated. Kind of like what Arsenal and other games have.
Every 30 seconds, I would check a datastore key if it is the same as the current server version (add a number value in ServerStorage or smth like that and the value would be the version) if the datastore key value is higher than the number value in ServerStorage , you would make the whole server rejoin the game, this is the only thing I could think of
And every time you publish, change the I’d to +1 and the datastore key +1 too
You could try attributes too or just assign a variable of server id in the script
Here would be an example
local currentverid = 1 while true do if (currentverid < game:GetService("DataStoreService"):GetDataStore("version"):GetAsync("version")) then --[[local hint = Instance.new("Hint") hint.Parent = game.Workspace hint.Text = "The server detected that the game was updated, updating server")]] -- this is a message giver, you can edit it to be a GUI -- instead , but this was quickly written so I used hint. for i,v in ipairs(game.Players:GetPlayers()) do game.TeleportService:Teleport(v,game.PlaceId) end task.wait(30) end
This code might be wrong, but it’s just an example.
An event. Have a script that uses os.time to check the time, and if the time is the right time, push the update out. This would require the update to be out beforehand, but after it is out, follow those steps, and it can be an auto-update.
Check out Soft Shutdown ! I use it in all my games and it’s super useful.
By the way, if you wanna use @geometricalC2123’s script, you would need to teleport in a separate place and then teleport them back since roblox doesn’t support teleporting back to the same place.
uhh no, i just did a recent experiment and that isnt required
You could use MessagingService to send out a command to every server. Easiest would be for the servers to respond to this command by shutting down (kick everyone and the server dies), but you may be able to make live updates from there.
Oh I’ll retry myself then, I checked a couple months ago and it didn’t work, I’ll check again