I have a model on Roblox of a system and I want to make a warn statement in the console that is only printed when the current version of the system is out of date with the version on the website. It wouldn’t update the model, just warn the user. It would only warn the user on server start-up, too.
I found this solution but I’m having a bit of trouble converting it to the system I have in mind.
I assume you will just need to compare the model’s current asset id to the id returned by GetLatestAssetVersionAsync. If they don’t match, print something out using warn().
Though, I’m not sure how you would get the current asset id of the old model currently being used. I guess you could get use GetLatestAssetVersionAsync, save that id to a data store the first time the model is used (the data store would return nil, so that’s how you know it’s the first time), and from then on you check the data store every now and then. If the value in the data store is different from GetLatestAssetVersionAsync, then you know it’s old. Just make sure to give the datastore a weird name or key like jsdhSs939832 so that you don’t overwrite the owner’s actual data.
There could be a better way, I haven’t done too much research.
How about this solution: In a module script in the model there is a integer version number. Every time the server starts up, it inserts the latest version parented to nil and checks the version number by requiring the module script. If the version number is less than the one that was just inserted then warn the user. Afterwards, destroy the newly inserted model for cleanup.
EDIT: I’ve tried this solution and it works great! Only change is instead of requesting a module, I just have a number value to check.