Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

Finding if there is a place update?

Asked by 8 years ago

Is there a way to detect if the current game server you are in is using an outdated copy of the game? Example: I want to make a little notification that the game has updated to anyone playing.

1 answer

Log in to vote
4
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
8 years ago

Great question! I've had a similar problem, but after about an hour of surfing the Wiki, I realized there was only one way to do this (At least, only one way I found). Using GetProductInfo, you're able to see the time at which the place was updated. Now, how are you going to compare it? Simple:

Below, I grabbed the milliseconds in which the place was updated, since it's not likely to ever get those exact numbers again:

local Asset = game:GetService("MarketplaceService"):GetProductInfo(364521806) -- My place Id
print(tonumber(string.sub(Asset.Updated, 18, 23)))

Alright, so now you have the time at which it was updated. You may be asking, how do I detect when it changes? Well, my favorite way is as follows: Create a value in ReplicatedStorage/Workspace/Anywhere (Won't really matter), and set it to the milliseconds it was updated, RIGHT when the server stops. So, when the first player joins, have it log the time. Alright. You could have a while loop check every second or so to see if the milliseconds have changes. If they have, then you can make it do whichever task you'd like it to.

Hope I helped!

Ad

Answer this question