Hello, I have been working on a script that recognises if the server is at the latest possible version. I thought the best way to do this was to create a script that when the new server starts up, it updates a variable to show the latest version.
I made this script to do that (running in ServerScriptService):
local DataStoreService = game:GetService("DataStoreService") local versionStore = DataStoreService:GetDataStore("versionData") local function version() local suc, err = pcall(function() versionStore:SetAsync("xdDxd8734372$$%^|%", game.PlaceVersion) game.ReplicatedStorage.MaxVersion.Value = game.PlaceVersion end) if err then version() end end version() local function update1() local success, currentVersion = pcall(function() return versionStore:GetAsync("xdDxd8734372$$%^|%") end) end local update = function() game.ReplicatedStorage.MaxVersion.Value = update1() end update = versionStore:OnUpdate("xdDxd8734372$$%^|%", update) print(game.ReplicatedStorage.MaxVersion.Value)
I went to test the script. However, the: OnUpdate function does not work over servers. Do you know an alternative to this function or a completely different way to do this (eg using Pastebin)?
Any help would be appreciated.