I am trying randomize the outfits of NPC’s that spawn with a list of shirts and pants. I’m having an issue when the NPC spawns they spawn with the shirt and pants with the intended ID’s but the clothes don’t show. They’re parented in the NPC but they aren’t appearing on said NPC. {The script doesnt throw any errors}
Is there anything I am doing wrong or forgeting?
local Shirts = {"rbxassetid://5258364225", "rbxassetid://4772210886", "rbxassetid://6714294027", "rbxassetid://7239470863", "rbxassetid://5092216954",
"rbxassetid://7730388262", "rbxassetid://5473281165", "rbxassetid://6671990960", "rbxassetid://7144612977", "rbxassetid://4955872544", "rbxassetid://1138763401",
"rbxassetid://5238572799", "rbxassetid://7250317770",}
local Pants = {"rbxassetid://6560857596", "rbxassetid://1710704401", "rbxassetid://5258365040", "rbxassetid://7250317770", "rbxassetid://4801770796"}
local RandomShirt = Shirts[math.random(1,#Shirts)]
local RandomPants = Pants[math.random(1,#Pants)]
local RandomFace = Clothing.Faces:GetChildren()[math.random(1,#Clothing.Faces:GetChildren())]
NPC:FindFirstChild("Shirt"):Destroy()
NPC:FindFirstChild("Pants"):Destroy()
local shirt = Instance.new("Shirt",NPC)
shirt.Name = ("Shirt")
shirt.ShirtTemplate = RandomShirt
local pants = Instance.new("Pants", NPC)
pants.Name = ("Pants")
pants.PantsTemplate = RandomPants
local face = RandomFace:Clone()
face.Face = ("Front")
shirt.Parent = NPC
pants.Parent = NPC
face.Parent = NPC.Head
end
repeat
spon = Spawns:GetChildren()[math.random(1,#Spawns:GetChildren())]
wait(.5)
until spon:IsA("BasePart")
local clone = NPC:Clone()
clone.Parent = NPCs
clone:MoveTo(Vector3.new(spon.Position.X, spon.Position.Y + 5, spon.Position.Z))
clone.lvl.Value = LevelRange
local Formula = math.floor(100+ (clone.lvl.Value*2))
clone.Humanoid.MaxHealth = Formula
clone.Humanoid.Health = Formula
clone.Name = ("lvl: "..clone.lvl.Value.." | "..clone.Name.." | ⚕️ "..clone.Humanoid.MaxHealth)