Update a folder across many places

Hello all!

I have a folder with a lot of models, and i need that folder on ReplicatedStorage on 13 places.
I’ve been using a Package to solve the updates, however even if the package auto updates, i still have to open every place and click “publish to roblox” to make the changes effective.
Any idea on how can i optimize this to avoid opening all the places and publisihng for every little change i have to make?

1 Like

Hey dude.

I’ve been having the exact same issue with my use of packages.
I think the auto update does work, it’s just, if you want the changes to publish immediately, you have to go onto every place and save, which kind of sucks for testing purposes at them moment but Roblox will probably address this.

The only other thing that might work for you is using the Insert service to load your models at run time.

Then you would only need to update the Models and save them to Roblox.
You could probably also look at creatingb an event that listens for changes in the model, and update them automatically while a server is running.

1 Like

That could be a solution, but im afraid that the folder downloads on the client everytime they join instead of checking if exist. Are you inserting the package with code? any latency problems?

No I just have a script (the package) in server script service that unpacks all my game code, modules, and assets into their respective locations.

It is basically plug & play, and great for setting up a place quickly for testing, however it has the same issue as what you mentioned in the OP, and requires updating individual places to see changes immediately.

Here’s my set up, if its any use to you.

local package = script:GetChildren()
local physicsService = game:GetService("PhysicsService")

function getGroupId(name)
	-- GetCollisionGroupId will throw if it does not exist
	local ok, groupId = pcall(physicsService.GetCollisionGroupId, physicsService, name)
	return ok and groupId or nil
end
 
-- returns a valid group id (int) or nil
function getOrCreateGroupId(name)
	local ok, groupId = pcall(physicsService.GetCollisionGroupId, physicsService, name)
	if not ok then
		-- Create may fail if we have hit the maximum of 32 different groups
		ok, groupId = pcall(physicsService.CreateCollisionGroup, physicsService, name)
	end
	return ok and groupId or nil
end

--Set up any required Collision Groups
local mId = getOrCreateGroupId("Model")
local gId = getOrCreateGroupId("Graphic")
local oId = getOrCreateGroupId("OutboxCollider")
local pId = getOrCreateGroupId("Player")
local pbId = getOrCreateGroupId("PlayerBlock")

physicsService:CollisionGroupSetCollidable("Model","Default",true)
physicsService:CollisionGroupSetCollidable("Model","Graphic",false)
physicsService:CollisionGroupSetCollidable("Model","Model",false)

physicsService:CollisionGroupSetCollidable("Graphic","Default",true)
physicsService:CollisionGroupSetCollidable("Graphic","Graphic",true)

physicsService:CollisionGroupSetCollidable("OutboxCollider","Default",true)
physicsService:CollisionGroupSetCollidable("OutboxCollider","Player",true)
physicsService:CollisionGroupSetCollidable("OutboxCollider","Model",false)
physicsService:CollisionGroupSetCollidable("OutboxCollider","Graphic",false)

physicsService:CollisionGroupSetCollidable("Player","Default",true)
physicsService:CollisionGroupSetCollidable("Player","Model",false)
physicsService:CollisionGroupSetCollidable("Player","Graphic",false)
physicsService:CollisionGroupSetCollidable("Player","Player",false)

physicsService:CollisionGroupSetCollidable("PlayerBlock","Default",true)
physicsService:CollisionGroupSetCollidable("PlayerBlock","Model",false)
physicsService:CollisionGroupSetCollidable("PlayerBlock","Graphic",false)
physicsService:CollisionGroupSetCollidable("PlayerBlock","Player",true)

-- Some compatibility for Touch screen users.
game.StarterGui.ScreenOrientation = Enum.ScreenOrientation.Sensor

--Script locations that should be enabled immediately
local enableImmediately = {"StarterPack","StarterGui","StarterCharacterScripts","StarterPlayerScripts"}

local finished = false
for _,p in pairs(package) do
	local parent = game:FindFirstChild(p.Name,true)
	for _,o in ipairs(p:GetChildren()) do
		o.Parent = parent
		if (o:IsA("Script")) then
			spawn(function()
				repeat until finished or table.find(enableImmediately,parent.Name)
				o.Disabled = false
			end)
		end
	end
end
finished = true

2 Likes

It’s a good approach to updates, thank you maybe i’ll use it :stuck_out_tongue:
I’ll be running some tests about loading the package by service

1 Like