Hello,
I’ve been developing random faces for my NPCs, however they are just not loading.
for i = 1, unitCount do local clone if i == 1 then clone = generalTemplate:Clone() else clone = unitTemplate:Clone() end clone.Parent = regimentFolder clone:SetPrimaryPartCFrame(CFrame.new(spawnPoint.Position + Vector3.new(0, 50, 0))) local xOffset = (col - unitsPerRow / 2) * spacing + math.random(1, 9) / 10 local zOffset = (row - unitsPerRow / 2) * spacing + math.random(1, 9) / 10 local groundPos = getGroundPosition(clone) clone:SetPrimaryPartCFrame(CFrame.new( groundPos.X + xOffset, groundPos.Y, groundPos.Z + zOffset )) local face = clone.Head:FindFirstChildWhichIsA("Decal") if face then face.Texture = "http://www.roblox.com/asset/?id=" .. tostring(Facesx[math.random(1, #Facesx)]) end table.insert(regimentData.units, clone) if row == 0 then table.insert(regimentData.firstRow, clone) end if i == 1 then regimentData.general = clone end col += 1 if col >= unitsPerRow then col = 0 row += 1 end end In the code you can see clearly:
local face = clone.Head:FindFirstChildWhichIsA("Decal") if face then face.Texture = "http://www.roblox.com/asset/?id=" .. tostring(Facesx[math.random(1, #Facesx)]) end This changes texture ID to one of these ids:
255827175,
277950647,
21311601,
150182378,
141728790
After joining, face will set to the expected asset ID, however it does not load and the head is faceless. To fix that issue, I have to go inside the properties tab, click on the Texture property and click enter to load it manually, it works then.
Evidence:
Expected behavior
I expect the script to load the face properly.


