Hey Devforum! So I made a pretty basic script that can randomize an NPC’s appearance (accessories and torso color).
local randomHat = math.random(0, 2)
local randomTorso = math.random(0, 1)
if (randomHat == 0) then
script.Parent.visor:Destroy()
else if (randomHat == 1) then
script.Parent.cap:Destroy()
else
script.Parent.visor:Destroy()
script.Parent.cap:Destroy()
end
end
if (randomTorso == 0) then
script.Parent.Torso.Color = Color3.fromRGB(13, 105, 172); -- blue
else
script.Parent.Torso.Color = Color3.fromRGB(196, 40, 28); -- red
end
I’m trying to figure out an efficient way for the code to randomize accessories instead of having the NPC wear all possible hats, and then deleting certain ones based on the output. What should I look for?
styleRandomizer.rbxl (46.9 KB)