Using InsertService its possible to insert a model from library or catalog.
What does it mean? - Making a automatically updating model.
Lets get into it!
-NOTE: You need publish your model or this script will not work.
local model = script.Parent
while not script.Parent:FindFirstChild("Version") do wait(0.1) end;
local modelVersion = model.Version.Value;
local modelID = 0000 -- Change this to your published model ID.
function checkForUpdate() -- Gets Updated Model (If its updated).
local newModel = game:GetService("InsertService"):LoadAsset(modelID)
-- Loads Model.
if newModel and newModel:FindFirstChild("Version") and newModel.Version:IsA("IntValue") and newModel.Version.Value > modelVersion then
-- Replaces model.
newModel.Parent = model.Parent
model:Destroy()
-- Destroys old model.
end
end
checkForUpdate() -- This script is working every second and every day. (Returns to checkForUpdate every 0.1 sec)
You did it!
Well done.
Enjoy using this script as long you can.
Thank you for reading! -- N00bRobloxian09.