![]() ![]() Local ReplicatedCommon = ReplicatedStorage:WaitForChild("Common") LocalUpdatePackagesScript:Clone().Parent = player:WaitForChild("PlayerGui") Local localUpdatePackagesScript = ServerScriptService:WaitForChild("Common"):WaitForChild("LocalUpdatePackages") UpdatePackageToLatestVersionFromCommonObjectParent(ServerScriptService)įor _, player in pairs(Players:GetPlayers()) do UpdatePackageToLatestVersionFromCommonObjectParent(StarterPlayer.StarterPlayerScripts) UpdatePackageToLatestVersionFromCommonObjectParent(StarterPlayer.StarterCharacterScripts) UpdatePackageToLatestVersionFromCommonObjectParent(ServerStorage) UpdatePackageToLatestVersionFromCommonObjectParent(ReplicatedStorage) UpdatePackageToLatestVersionFromCommonObjectParent(ReplicatedFirst) LatestPackage:WaitForChild("Common").Parent = CommonParent Until #latestPackage:WaitForChild("Common"):GetDescendants() >= descendantsCount - 1 Check if all descendants have loaded in Local descendantsCount = #CommonParent:WaitForChild("Common"):GetDescendants()ĬommonParent:WaitForChild("Common"):Destroy() Local latestVersionId = InsertService:GetLatestAssetVersionAsync(packageId) Local packageId = GetPackageIdFromCommonObjectParent(CommonParent) Local function UpdatePackageToLatestVersionFromCommonObjectParent(CommonParent) Local packageId = CommonParent:WaitForChild("Common"):WaitForChild("PackageLink").PackageId Local function GetPackageIdFromCommonObjectParent(CommonParent) If packageAutoUpdate:WaitForChild("UpdatePackages"):GetAttribute("ForceUpdate") = false then return end Local packageAutoUpdate = InsertService:LoadAsset(13946162020) - Change ID to Model ID that has an attribute boolean called "ForceUpdate". Get PackageAutoUpdate and check if ForceUpdate attribute is active LatestPackage:FindFirstChildOfClass("Script").Parent = ServerScriptService Local latestPackage = InsertService:LoadAssetVersion(latestVersionId) Local latestVersionId = InsertService:GetLatestAssetVersionAsync(tonumber(subbedText)) Local subbedText, occurances = string.gsub(packageId, "%D", "") - Removes rbxassetid:// from PackageId string Local packageId = script:WaitForChild("PackageLink").PackageId If script:FindFirstChild("PackageLink") then If this script has a package link, it may not be the latest version. If RunService:IsStudio() then return end - To test this script in studio, disable this line and run in test server only Local StarterPlayer = game:GetService("StarterPlayer") Local ServerStorage = game:GetService("ServerStorage") Local ServerScriptService = game:GetService("ServerScriptService") Local ReplicatedStorage = game:GetService("ReplicatedStorage") Local ReplicatedFirst = game:GetService("ReplicatedFirst") Local TeleportService = game:GetService("TeleportService") Local Players = game:GetService("Players") Local RunService = game:GetService("RunService") Local InsertService = game:GetService("InsertService") You will need to adjust it for your own game. You can find a copy of the code I used for my game below. ![]() This is so that your local scripts don’t break or create 2 of the same player gui’s) ( Note: You may need to adjust the code to detect if the player already has some player gui’s, or to delete player gui’s before getting the latest version of the package. Set the latest package parent to the parent of what the old package used to haveĬlone a local script to all players that does the same as step 5 & 6, but for local scripts instead. Inserted packages will NOT have a PackageLink object) Sometimes you will find that it creates a new model with your package inside of it, so you may need to get the first child. Use InsertService to get the latest asset of the package with the “latest asset version ID” ( Note: Check what object got inserted. Get the latest asset version ID for that package ID Get package ID from the “PackageLink” object that is created when inserting packages If it is true, then replace all packages. I did this by making a separate model with a bool attribute. I did the following:Ĭheck if you want to replace packages. I could not wait for Roblox staff to fix this issue, so I created a workaround that treats packages as assets instead (Similar to when you publish your own model). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |