How do I make the player have a random outfit (out of shirts, pants, faces, skintones, and hairs of my choosing) each time they spawn/respawn?
u can use the math.random(x, y) function to get a random number value from x to y
GetChildren() returns an array of instances (essentially pairs of numbers associated with their corresponding instance)
store all of ur shirts, pants, faces, bodycolor instances etc inside of replicated storage in separate folders
then when a player joins and when their character loads, u can simply just replace the outfits and accessories by looping through their character and removing those instances and replacing them with the randomly chosen appearance configuration
Building off of this, you can use the # operator to make it more streamlined.
Say you have a folder named “Accessories” in ReplicatedStorage. You could do this:
local folder = game:GetService("ReplicatedStorage")
local player = game:GetService("Players").LocalPlayer -- if you want to use this, you should use a LocalScript. This will only show the accessories on the client side, though, so maybe do it through a RemoteEvent
for _, accessory in pairs(folder:GetChildren()) do -- loops through each accessory type (e.g., "Hair", "Hats")
local char = player:CharacterAdded()
local newAccessory = accessory:GetChildren(math.random(1, #accessory:GetChildren())):Clone() -- randomizes it to choose a number from 1 to the number of children
newAccessory.Parent = char
end
However, you will have to do something a bit differently with the skin tones because they are numbers. You could also try to use tables with asset IDs, and then choose one randomly and load it using InsertService.
when they talked about skin tones I’m pretty sure they just want some select predefined skin tones so bodycolor instances work fine for this