Is there a way to do this?

I have a Zombie game. And I need to have a collection of different clothing for multiple zombies to avoid repeats. I could do this manually which takes forever. But I had an idea, when a player plays the game and dies or just plays the game. His avatar clothing is added to a data base that the game can then read and when creating a new zombie take this players clothing for use.

Is this possible? How would I go about it?

I’d imagine that player clothing can be saved inside datastores the same way global leaderboards use datastores to display leaderstat values.

I had another thought for randomized clothing without having to manually input ids, you could loop pcall MarketPlaceService:GetProductInfo on randomly generated asset ids until it successfully finds X amount of valid shirts/pants, and them add them into a table for the npc clothing to read from. As a reference, the AssetTypeId for shirts is 11 and 12 for pants.

Here’s a quick example of what I’m thinking of:

local shirtTable = {}
local pantsTable = {}

local function check(assetId)
   local sucess, result = pcall(function()
      return game:GetService("MarketplaceService"):GetProductInfo(assetId)
   end)

   if success then
      if result.AssetTypeId == 11 then
         table.insert(shirtTable, assetId)
         return true
      elseif result.AssetTypeId == 12 then
         table.insert(pantsTable, assetId)
         return true
      else
         return false
      end
   else
      return false
   end
end

local clothingCount = 0
while clothingCount <= 10 do
   local randomAsset = math.random(1000000000,9999999999)
   if check(randomAsset) then
      clothingCount += 1
   end
   task.wait()
end

Sure, it can be done, but, in that way would be better to just grab the HumanoidDescription of random players.

Similar to what @PR_0B suggest on grabbing random shirts and pants and build a table by trying random IDs on a loop, the same could be used to get a full HumanoidDescription from random players, which includes everything shirt, pants, bodycolors, face, accessories, cloths, etc.
And from the HumanoidDescription you could delete what you dont want to use.
So there’s no need to save anything on DSS

Random humanoid descriptions would certainly work as well but I’d imagine a majority of zombies would show up looking a particular way :wink:
image

2 Likes

LOL! yeah, thats funny, yeah why not, lots of baconZombies xD

1 Like

I suggest pulling some IDs using an offsite script (similar to a script that buys every free item by roblox) from some groups with clothing you think looks good, then using those.

Or just pull clothing IDs from a few thousand players, ensuring they’re not default clothes (Roblox Free clothing) and adding them to separate databases (Shirts/Pants) then mix and match those, as they will create (Number Of Players Clothing Pulled) ^ 2 combinations.

Or, alternatively, upon a player starting a match, you can pull their friends, pull the HumanoidDescriptions of their friends, mix and match shirts/pants, and call that good, with no need to store anything.