Rthro Rig Height Scale Normalizer

Hey, I’m so sorry for the continued necropost.

If EgoMoose sees this, thanks so much for your hard work on this system as a whole - it’s really all-encompassing and well made - it’s wonderful. And your GitHub documentation is great. I barely know what I’m doing - my programming knowledge is extremely novice and I’m basically throwing spaghetti at the walls and I was still able to use it pretty easily, with some looping.

That said, I was hoping to reach out and see if you or anyone here might have any recommendations for calling/applying the function on rigs in child folders, not just directly. I’m trying to do stuff with like 105 rigs, and just want to try to organize it a little better so I don’t lose my mind.

This is my current execution script to apply the normalizer function.

local rScaler = require(game.ServerScriptService.RthroScaler);
local avatarsLoaded = game.ReplicatedStorage:WaitForChild("AvatarsInitialized")

avatarsLoaded.Event:Connect(function()
	for i, rigPerson in ipairs(workspace.RigCalls:GetChildren()) do
		print("I got called on", rigPerson.Name) --I will lose my mind if I'm doing this blind I need to keep track
		rScaler.classic(rigPerson, 1)
		for h, part in rigPerson:GetDescendants() do
			if part:IsA("ParticleEmitter") then
				part:Destroy()
			end --end if/then
		end --end for/do particle destroyer
	end --end for/do rig scaler
end) --end eventcall

As it stands, this only works if all ~105 rigs are in the same folder. I would like to split them up into sub-folders for organizational purposes, but then it can’t find them.
I tried replacing workspace.RigCalls:GetChildren() with workspace.RigCalls:GetDescendants() and a LUA demon came out of my screen and beat me up, so… that’s not gonna work.

I’m just hoping to get some input/advice to see if there’s a simple in-line fix I can get away with, or if my only practical option is to go through and loop again for every sub-folder. No biggy if that’s the case, but I want to try to avoid it if I can

Without knowing more about the structure of your folder(s) the most practical and all encompassing solution for your issue is to use the collection service.

This will mean you need to add a tag to all the rigs in your game, but then you can do the following:

avatarsLoaded.Event:Connect(function()
	-- loop through all the instances with the following tag in the game
	for _, taggedRig in CollectionService:GetTagged("scaledAvatarRig") do
		-- only use tagged rigs that are descendants of this folder
		if taggedRig:IsDescendantOf(workspace.RigCalls) then 
			-- apply the rthro scaler
			rScaler.classic(taggedRig, 1)
		end
	end
end)

Hope that helps!

I tried to get a grasp on tags the other day but couldn’t figure out how to use them effectively from documentation alone. You are an actual saint. Thank you so, so much!