How to make an auto-updating model: Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>WildSurvival New page: {{CatUp | Tutorials}} ==First Off== This will not work if you don't wish to have your model published. You can either create a simple script or apply it into this. Now create a blank model... |
>NXTBoy |
||
(8 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{CatUp | Tutorials}} | {{CatUp | Tutorials}} | ||
{{disambig|[[Updating_Model_Tutorial|'''''Updating''''' a model]]}} | |||
==First Off== | ==First Off== | ||
This will not work if you don't wish to have your model published. You can either create a simple script or apply it into this. Now create a blank model, a blank script in the model, and IntValue in this model called "Version", change the value to "2". Publish this as a model. Now create a new script and dont bother about the other model. Create another IntValue called "Version", put it in this new script. Make the value "1" | This will not work if you don't wish to have your model published. You can either create a simple script or apply it into this. Now create a blank model, a blank script in the model, and IntValue in this model called "Version", change the value to "2". Publish this as a model. Now create a new script and dont bother about the other model. Create another IntValue called "Version", put it in this new script. Make the value "1" | ||
==Creating the script== | ==Creating the script== | ||
function | local model = script.Parent | ||
local modelID = 0000 -- Change this to the model id of the model you created earlier | |||
Version | function checkUpdate() | ||
local newModel = game:GetService("InsertService"):LoadAsset(modelID) | |||
if model.Version.Value < newModel.Version.Value then | |||
end | newModel.Parent = model.Parent | ||
model:remove() | |||
-- | end | ||
end | |||
checkUpdate() -- You can either put this in a loop, or call it once. I reccomend calling it once. | |||
Now just copy this scripts contents and paste it into the Model's script. Now just update the model and leave this in your place. It should work. If not, or there are errors, use the discussion. | Now just copy this scripts contents and paste it into the Model's script. Now just update the model and leave this in your place. It should work. If not, or there are errors, use the discussion. |
Latest revision as of 11:16, 7 August 2011
You might be looking for one of these pages:
Updating a model
First Off
This will not work if you don't wish to have your model published. You can either create a simple script or apply it into this. Now create a blank model, a blank script in the model, and IntValue in this model called "Version", change the value to "2". Publish this as a model. Now create a new script and dont bother about the other model. Create another IntValue called "Version", put it in this new script. Make the value "1"
Creating the script
local model = script.Parent local modelID = 0000 -- Change this to the model id of the model you created earlier function checkUpdate() local newModel = game:GetService("InsertService"):LoadAsset(modelID) if model.Version.Value < newModel.Version.Value then newModel.Parent = model.Parent model:remove() end end checkUpdate() -- You can either put this in a loop, or call it once. I reccomend calling it once.
Now just copy this scripts contents and paste it into the Model's script. Now just update the model and leave this in your place. It should work. If not, or there are errors, use the discussion.