✓ Accepted answer
Please read on how
game.PlaceVersion works. It says in the roblox official wiki that this variable is not updated, and only shows the place version that the server is currently on, in this case, it returns the exact same value as currentVer. You need to save the new version in a data store, and have every server check its version against the datastore version, and if their version is greater, then set the datastore version to that server's version, doing this will allow servers to then check their version against the datastored version to see if their version is less then, if so, then you change the text.
Heres a dummy script, which you will need to change to suit your needs.
local datastore= game:GetService("DatastoreService"):GetDatastore("GameVer")
local key= "serverversion"
local placeVer= datastore:GetAsync(key)
local currentVer= game.PlaceVersion
if placeVer then
if placeVer<=game.PlaceVersion then
datastore:SetAsync(key,game.PlaceVersion)
currentVer= game.PlaceVersion
end
else
datastore:SetAsync(key,game.PlaceVersion)
end
while wait() do
while wait(6) do
placeVer= datastore:GetAsync(key)
if not placeVer then
break
end
repeat wait() until placeVer>currentVer
end
end
If you want my module to make datastore setting, getting and saving a little easier(also has a neat function to save almost all value objects), then click here.
5 comments
Explain better. Console errors, what's it supposed to do, etc.
No errors in console. I am checking the game version and if it is not the same as the current game to change a gui textbox text value.
Its to show players in game that the server is old.
I see the problem now the (game.PlaceVersion) is pulling from the game not Version history on Roblox. Now how would I get the Version history from Roblox? I am reading this: https://developer.roblox.com/api-reference/property/DataModel/PlaceVersion
But if the place is outdated it will automatically disconnect everyone