Hello! Recently, I’ve found it necessary to create a module that checks the version of the current game and place to see if the server is running on the latest update of the game. This module is completely open-sourced, and doesn’t rely on DatastoreService or MessagingService to accomplish it’s goal. Below is an example usage of it:
local m = require(path.to.module)
m:SetCheckFrequency(3)
m.PlaceUpdated:Connect(function(date)
warn("Place has updated. ii repeat, place has updated!!!")
-- I recommend disconnecting this event if
-- you only want to receive the information once, as this
-- will fire with every update!
end)
m.Activate()
Now I published, went into the live game and opened the Developer Console, and published again. Here is my output.
Wow. I am going to use this for a system that will make a message pop-up on an admins screen asking them if they want to shutdown all servers, or just the current.
Some games, like my game Midnight Vibe, have different “districts” you can traverse. Each district has it’s own place. If you wanted to see if there was a new update to the entire game, you’d use the game signal. If you wanted to see if there was an update to just that particular district, you’d use the place signal.
That’s just one application. There are plenty of games that update only particular places in their game at a time, and this would benefit them.
I believe we misunderstood each other.
To clarify, I was talking about the :Activate() functions, I was suggesting you only need a function and a signal for place updated and game updated.
Activate turns on the module. As it’s a module script, it can’t run without external help. There is only one Activation function, and one Deactivation function. I’m confused on how I could make it any simpler. Sorry.
If you could, give me a pseudo-code example on what you think would be easier to understand. Thanks!
require() allows whatever was returned from the ModuleScript to be referenced. My module returns a table. Check out how ModuleScripts are typically organized here.
You can run code within a module script as well. Whenever it is required, the code will run. For example:
local module = {1,2,3,4,5,"test"}
print("module loading")
return module
It will return the table, but it will also run the print function. What @OminousVibes0 is saying is that the :Activate() method is useless in the case that you can just run code inside the module.
Either way it will have the same result, but having an initialize method is just an extra unnecessary step.
Okay. I like having the ability to turn the module on or off, so I’m not going to change the module. It’s just one extra line of code so I don’t think it matters in the slightest. Thanks for the suggestion though, you’re welcome to change the module yourself if you see fit.
I only found this recently and it’s really cool! I made a text label that changes whether the game is up to date or not. I’ll show some pictures below.
local m = require(game.ReplicatedStorage.VersionChecker)
m.Activate()
local label = script.Parent
local value = m:IsPlaceUpToDate()
while true do
value = m:IsPlaceUpToDate()
task.wait(5)
if value == false then
if label then
label.Text = "Server is out of date"
label.TextColor3 = Color3.new(1, 0, 0)
break
end
end
if value == true then
if label then
label.Text = "Server is up to date"
label.TextColor3 = Color3.new(0.333333, 1, 0.498039)
end
end
end