I’m looking into auto updating my model as it is a pain for people who use models to reinstall them, so I’m wondering how would I make my model have the ability to auto update when I add a new update? Any response is appreciated.
I also would be fine if there was at least an alert on using the model in game that there was a new version available.
https://www.roblox.com/library/156627286/Auto-Update-Model-Script (Is bad but is work but what do you want to do? update the models when you update them or force all the servers to update when you update)
I want the model to update to the latest version when I push out an update.
a single model where the whole server?
Can you rephrase? I’m confused on what you’re asking.
you want to update the model (model updated )or the whole server (server updated) when there is an update?
When theres an update, I want the model to have the latest update and features that were released, so heres an example.
I update the model with lets say a bigger button → Publish it → The games that use my model now have a bigger button
This is a exemple the script is in the model with a int value named version (It’s up to you to modify it to optimize it, otherwise create your own script with the GetService / Insert Service system)
local model = script.Parent
while not script.Parent:FindFirstChild("Version") do wait(0) end;
local modelVersion = model.Version.Value;
local modelID = 156637804 -- Change this to the model id of the model you created earlier
function checkForUpdate()
local newModel = game:GetService("InsertService"):LoadAsset(modelID)
newModel.Parent = model.Parent
model:Destroy()
end
end
checkForUpdate()
Source of script → https://www.roblox.com/library/156627286/Auto-Update-Model-Script
Do you have an example of how this is used? It’s hard to understand from just the script.
This script just reintegrate the model without checking the version, you want to reintegrate the model, check the “Valueint” version to see if it is superior to the current model and if these replace the current model with the new model
exemple
local model = workspace.ImAModel
local newModel = game:GetService("InsertService"):LoadAsset(model id here)
local ActualVersion = model.version.value
if newModel.version.value > ActualVersion then
newModel.Parent = model.Parent
model:Destory()
else
newModel:Destroy()
end
I made this script very quickly, it is normal that there are errors
So like this?
yea, try to push a update of your model and keep the current version, add a print (“Updated”) just to check that everything works well
Else you can use a module to with a require() but is different(may work better in some cases)
How would I use a require? (30chars)
So, if you have this in your module
local module = {}
function module:Fire(Path)
local TheGroup = script.NAME_HERE:Clone() -- put the object u need to update here
TheGroup.Parent = Path
end
return module
Now publish the module and after in a script script you can call it
require(ID):Fire(game.workspace)
the only problem is that the modules have to be public
I don’t have a problem with my module being public as my scripts are open source anyway.
How would I carry over information like with the require()
perks = true
gamepassid = –