How can I make a script connect to a module script to check if the model is in date? For example send “1” to the module, and the module checks if “1” is the current version or if something else is.
You can use this to fetch the product info of the asset and then compare if the given update date is different then the one you stored when you first ran the game.
No, no. I manually set the version myself.
This is what I have so far:
In a server script:
local mol = require(id)
if mol.CheckVersion("2") then
print("up to date")
end
In a module script:
local module = {}
function module:CheckVersion(version)
if not version == "2" then
warn("Out of date! Current version is 2!")
end
end
return module
But, of course the server script doesn’t work because the CheckVersion module doesn’t return anything. So did I do anything wrong, and how can I return a value, so the server script works?
So in the if not version == “2” then you forgot to return false.
After the if end statement add a return true
I changed it to
local module = {}
function module:CheckVersion(version)
if not version == "2" then
warn("Out of date! Current version is V2!")
return false
end
return true
end
return module
but out of date prints if I do if not version ==“2” or if I do “1”
You could try doing
if version == "2" then
return true
end
warn("Out of date! Current version is V2!")
return false
1 Like