Reducing Animated Model Lag - "Deleting" Transparent Objects?

Hello! I’m Oliver and I’m working on a project, Warrior Cats: Uncharted Territory. I wrote in the past about lag reduction for the map size of my game, and people recommended content streaming for lag reduction. That seemed to solve the map size issue, but now I’m met with a new issue.
Every player (which is at least 200 players per server) spawns as a feline. The feline model has about 20 or so mesh parts. There are planned customizable features such as markings, limb parts (ear shape, tail size, etc.), and accessories like collars or plants.
I recently asked Vizavi (one of the developers of Warrior Cats: Ultimate Edition) how you would toggle those accessories on an animated model, and they told me I was meant to weld it to the model and turn the transparency on and off. An obvious problem here is the individual lag, so many characters walking around with so many options on them just hidden in plain sight? That’s a lag machine.
I asked Vizavi what they did about lag, but all they said was “we actually “destroy” all parts that are not transparency 0 when you hit finish to reduce lag”. I barely understand this. I’m thinking maybe they meant when they click the finish button on character creation, every object that is transparent is removed, but I don’t know how this would work at all.
If anyone has any advice at all on how to “delete” those transparent parts for a single person after clicking finish, I’d appreciate it! It’s important to note that I don’t really know anything about coding, so general specifics are appreciated.
If you wish to offer further support, please contact me on Discord at Kiramclome#4240.

Invisible parts aren’t included in the rendering pipeline so it’d be up to your use case for determining specifically if just setting transparency is enough or if it’s more reasonable to destroy those parts. In your case I can see why it’d be better to only actually keep visible content.

What they’re doing sounds simple in practice if I’m getting this information right: when the player clicks finish on their customisation it fires a RemoteEvent telling the server that it finished, then the server goes ahead and destroys anything not transparent.

for _, part in ipairs(character:GetDescendants()) do
    -- Explicitly check for invisible so translucent parts aren't caught
    if part.Transparency == 1 then
        part:Destroy()
    end
end
2 Likes